File content verification method and system based on pattern recognition
By combining the improved HRNet and LayoutLMv3 networks, the challenges of structural recognition errors and anomaly detection in document verification were solved, achieving high-precision and intelligent document content verification, adapting to diverse layout structures, and improving the intelligence level and generalization ability of the verification system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-08
- Publication Date
- 2026-05-19
AI Technical Summary
Existing document verification technologies are sensitive to image quality fluctuations, have reduced text detection accuracy, struggle to effectively utilize the inherent relationship between image structural information and text semantic information, lack an end-to-end structural consistency scoring mechanism, resulting in high rates of structural recognition errors and field misjudgments, and are unable to cover complex and abnormal situations.
An improved HRNet network is used for structural pattern resolution preservation and differential enhancement processing. An improved LayoutLMv3 network is combined for joint reasoning of text semantics and visual structure. Through multi-resolution feature extraction, structural consistency discrimination and region consistency attention model, the integrity of archive structure and anomaly detection are achieved.
It improves the accuracy of document structure recognition, enhances anomaly detection capabilities, provides interpretability for structural consistency scoring and verification results, adapts to diverse layout structures, and enhances the intelligence level and generalization ability of the verification system.
Smart Images

Figure CN122067259A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent archive processing technology, and in particular to an archive content verification method and system based on pattern recognition. Background Technology
[0002] With the continuous improvement of digital archival management and the increasing demand for archival compliance review, pattern recognition-based automatic verification technology for archival content is gradually becoming an important direction for the construction of intelligent archival systems. Currently, the mainstream digital archival verification process mainly relies on OCR text recognition and manually set field matching rules for initial verification. However, in large-scale archival governance scenarios, the following problems commonly exist: Existing methods are sensitive to image quality fluctuations, and text detection accuracy drops significantly under conditions of noise, tilt, and complex layouts, leading to inaccurate localization of key structural regions and consequently affecting the effectiveness of subsequent content parsing and field consistency judgment. The decoupled modeling approach of image structural information and text semantic information cannot fully utilize the inherent correlation between the layout pattern and semantic rules of archives, which easily leads to structural recognition errors and increased field misjudgment rates. In addition, existing archive verification strategies generally lack end-to-end structural consistency scoring mechanisms and intelligent abnormal content discrimination models, making it difficult to cover complex abnormal situations such as non-standard formats, field misalignment, structural overlap, or omissions, which seriously restricts the intelligence level and generalization ability of the verification system.
[0003] Therefore, how to provide a method and system for verifying the content of archives based on pattern recognition is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0004] One objective of this invention is to propose a method and system for verifying archival content based on pattern recognition. This invention uses an improved HRNet network to perform resolution-preserving modeling and structural difference enhancement processing on the structural patterns of archival images, and introduces an improved LayoutLMv3 network to achieve joint reasoning and region consistency discrimination of textual semantics and visual structure, thereby completing intelligent verification of whether the archival structure is complete, abnormal, or missing. This invention has the advantages of high structural recognition accuracy, strong anomaly detection capability, strong interpretability of verification results, and adaptability to diverse layout structures.
[0005] A method for verifying archive content based on pattern recognition according to an embodiment of the present invention includes the following steps: Step 1: Obtain the original image of the document to be verified; Step 2: Standardize the original archival images to generate standard archival images; Step 3: Perform text detection and text recognition on standard archival images to obtain semantic region identifiers of archival text content and structure; Step 4: Input the standard archive image and structural semantic region identifiers into the improved HRNet network, perform multi-resolution structural feature extraction and structural difference enhancement modeling, and generate a set of regional structural feature vectors and structural pattern feature maps. The improved HRNet network includes an initial feature extraction module, a multi-resolution parallel convolution module, a cross-branch feature fusion module, a structural consistency modeling module, and a structural difference enhancement module. Step 5: Semantically aggregate the structural pattern feature maps to construct visual structure embedding vectors; Step Six: Input the archive text content, regional structure feature vector set, and visual structure embedding vector into the improved LayoutLMv3 network, perform regional consistency attention modeling and structure discrimination inference, and generate archive structure discrimination results; the improved LayoutLMv3 network includes a text semantic embedding module, a regional consistency attention module, a regional structure scoring module, and a structure discrimination output head; Step 7: Based on the results of the archive structure assessment, generate an archive content verification conclusion.
[0006] Optionally, step two specifically includes: The standardization process includes image resolution normalization, image orientation correction, grayscale conversion, and image noise suppression. The image resolution normalization uses bilinear interpolation to resample the resolution of the original archive image to a set target resolution, generating a normalized archive image. The image orientation correction specifically involves: constructing an orientation histogram based on the edge orientation of the normalized archival image, identifying the main orientation angle of the normalized archival image, and rotating the normalized archival image counterclockwise according to the main orientation angle to generate an orientation-corrected archival image; The grayscale conversion specifically involves: obtaining the R channel value, G channel value, and B channel value of each pixel position in the orientation-corrected archive image, performing a weighted average according to a preset weighting coefficient to generate the corresponding grayscale value, and constructing a grayscale archive image based on the grayscale value; Image noise is suppressed in grayscale archival images using Gaussian filtering to obtain standard archival images.
[0007] Optionally, step three specifically includes: Perform text detection on standard archival images to obtain all text candidate regions in the image; Identify the text characters in each text candidate region, obtain the text character sequence, and then combine the text character sequences of all text candidate regions into the archive text content in order; Based on the vertical position ratio, area ratio, and character density of each text candidate region in the standard archival image, determine the structural semantic region and its identifier for each text candidate region. The structural semantic regions and their identifiers specifically include title: T, body: B, table: L, and signature: S.
[0008] Optionally, step four specifically includes: In the initial feature extraction module, a two-dimensional convolution operation with a kernel size of 3×3 and a downsampling operation with a stride of 2 are sequentially performed on the standard archive image to obtain the initial structural feature map; The initial structural feature map is input into a multi-resolution parallel convolution module, which includes parallel high-resolution branches, medium-resolution branches and low-resolution branches. The high-resolution branch generates a high-resolution structural feature map by passing the initial structural feature map through two layers of 3×3 two-dimensional convolution, batch normalization, and ReLU activation function; The medium-resolution branch generates a medium-resolution structural feature map from the high-resolution structural feature map by downsampling with a stride of 2 and two layers of 3×3 convolution. The low-resolution branch generates a low-resolution structural feature map by downsampling the medium-resolution structural feature map with a stride of 2 and two 3×3 convolutions. In the cross-branch feature fusion module, the low-resolution structural feature map is upsampled using bilinear interpolation to obtain the upsampled structural feature map, and the high-resolution structural feature map is downsampled with a step size of 2 to obtain the downsampled structural feature map. The upsampled structural feature map, the medium-resolution structural feature map, and the downsampled structural feature map are respectively channel-aligned by 1×1 convolution, and then fused by pixel-by-pixel summation to obtain a fused structural feature map. In the structural consistency modeling module, each text candidate region is mapped to the fused structural feature map space through coordinate transformation; Based on the semantic region identifiers of each structure, a title mask matrix, a body text mask matrix, a table mask matrix, and a signature mask matrix are constructed respectively; Based on the title mask matrix, body text mask matrix, table mask matrix, and signature mask matrix, feature aggregation is performed on the fused structural feature map through regional average pooling to obtain title structure feature vectors, body text structure feature vectors, table structure feature vectors, and signature structure feature vectors, which are then combined into a regional structure feature vector set. A structure template library is set up, which includes a reference structure template feature map and a reference structure feature vector set of the file to be verified; In the structural differential enhancement module, the feature map of the reference structural template of the file to be verified is obtained; Align the fused structural feature map with the reference structural template feature map in both spatial and channel dimensions, and perform pixel-by-pixel differencing to obtain a structural difference feature map. Then, fuse the structural difference feature map with the fused structural feature map pixel-by-pixel to obtain a structural pattern feature map.
[0009] Optionally, step five specifically includes: Global average pooling is performed on the structural pattern feature map in the spatial dimension to obtain the global structural feature vector; The global structural feature vector is linearly transformed using a trainable visual structural weight matrix and a visual structural bias vector to generate a visual structural embedding vector.
[0010] Optionally, step six specifically includes: The text semantic embedding module extracts semantic features of the archival text content through a pre-trained RoBERTa model to obtain an archival text embedding sequence; the archival text embedding sequence includes several token vectors. The archival text embedding sequence and the visual structure embedding vector are concatenated to obtain a joint embedding sequence; In the region consistency attention module, multi-head attention operations are performed on the joint embedding sequence to generate a fused attention embedding sequence, specifically: Set the number of multi-head attention operations. In each attention head, the joint embedding sequence is transformed into a query matrix, a key matrix, and a value matrix through three sets of trainable linear mapping matrices. Perform matrix multiplication on the query matrix and the key matrix, and scale the matrix by the dimension of the key matrix to obtain the original attention score matrix. Construct the attention-guided bias matrix; The original attention score matrix and the attention guidance bias matrix are added element by element, and then normalized using the Softmax function to obtain the attention weight matrix for each attention head. Perform matrix multiplication on the attention weight matrix and value matrix of each attention head to obtain the attention output feature matrix; The attention output feature matrices of all attention heads are concatenated and then feature-mapped through a trainable linear mapping layer to obtain a fused attention embedding sequence; the fused attention embedding sequence includes four fused attention embedding vectors. In the regional structure scoring module, the reference structure feature vector set of the archive to be verified is obtained from the structure template library; The reference structural feature vector set is compared with the regional structural feature vector set one by one. The structural consistency score of each structural semantic region is calculated by cosine similarity and the structural consistency score vector is formed. The structural consistency score vector and the fusion attention embedding sequence are input into the structural discrimination output head to generate the archive structural discrimination result, which includes the structural anomaly category, the structural verification passed label and the structural missing prompt.
[0011] Optionally, constructing the attention-guided bias matrix specifically includes: Based on the i-th and j-th vectors in the joint embedding sequence, the corresponding structural semantic region identifiers are obtained respectively; If the structural semantic region identifier to which the i-th vector belongs is the same as the structural semantic region identifier to which the j-th vector belongs, then the element in the i-th row and j-th column of the attention-guided bias matrix is set as a positive bias value. If the structural semantic region identifier to which the i-th vector belongs is different from the structural semantic region identifier to which the j-th vector belongs, then the element in the i-th row and j-th column of the attention guidance bias matrix is set as the suppression bias value. Both the forward bias value and the suppression bias value are preset constants. The forward bias value ranges from [0.5, 1.0], and the suppression bias value ranges from [−1.0, 0].
[0012] Optionally, the generated archive structure discrimination result specifically includes: Each fused attention embedding vector is used to generate a hidden feature vector through a linear mapping and GELU activation. The hidden feature vector is then used to generate the structural anomaly logits value of the current region through a linear mapping. The structural anomaly logits value is then normalized through the Softmax function to obtain the structural anomaly probability. Set consistency and anomaly thresholds, and perform anomaly detection for each structural semantic region: If the structural consistency score of the current structural semantic region is lower than the consistency threshold, or the structural anomaly probability is greater than the anomaly threshold, then the current structural semantic region is determined to be a structural anomaly region and the structural anomaly category is marked. If the structural consistency score of the current structural semantic region is greater than or equal to the consistency threshold, and the structural anomaly probability is less than or equal to the anomaly threshold, then the current structural semantic region is determined to be a structurally normal region, and a structural verification pass label is output. If two or more structural semantic regions simultaneously satisfy the consistency score being lower than the consistency threshold and the structural anomaly probability being greater than the anomaly threshold, then the current file to be verified is determined to have a structural missing risk, and a structural missing warning and a set of structural anomaly regions are output.
[0013] Optionally, the verification conclusion of the archive content includes the structural consistency score, structural anomaly probability, structural anomaly category or structural verification pass label, structural anomaly area and structural missing prompt for each structural semantic region in the archive to be verified, and the archive content verification conclusion is output in JSON format.
[0014] According to an embodiment of the present invention, a file content verification system based on pattern recognition includes: Image acquisition module: Used to acquire the original images of the documents to be verified. The image preprocessing module is used to standardize the original archival images and generate standard archival images. The structure extraction module is used to perform text detection and text recognition on standard archival images; The structural feature modeling module is used to generate regional structural feature vector sets and structural pattern feature maps through the improved HRNet network; The visual structure building module is used to construct visual structure embedding vectors; The structure discrimination modeling module is used to generate the file structure discrimination results of the files to be verified through the improved LayoutLMv3 network; The verification conclusion generation module is used to generate verification conclusions for the archive content.
[0015] The beneficial effects of this invention are: This invention effectively improves the accuracy and intelligence of archival structure and content consistency judgment. First, through an image acquisition module and an image preprocessing module, standardized operations such as resolution normalization, orientation correction, grayscale conversion, and noise suppression are performed on the original archival images to generate standard archival images with clear structure and uniform quality. Then, based on a structure extraction module, text detection and recognition are performed, and combined with rules such as vertical position ratio, area ratio, and character density, structural semantic regions and their identifiers are automatically labeled, achieving precise positioning of key areas such as titles, body text, tables, and signatures.
[0016] Secondly, by utilizing the improved HRNet network in the structural feature modeling module, while retaining the high-resolution branch, multi-resolution parallel convolution, cross-branch feature fusion, structural consistency modeling, and structural difference enhancement modules are integrated to extract regional structural feature vector sets and structural pattern feature maps from standard archival images and structural semantic region identifiers. This significantly enhances the modeling and expressive capabilities for complex layout structures and the responsiveness to structural anomalies. Furthermore, the visual structure construction module performs global average pooling and linear transformation on the structural pattern feature maps to generate visual structure embedding vectors for structural semantic association.
[0017] Furthermore, the structure discrimination modeling module integrates text semantic embedding, region consistency attention, and region structure scoring. It uses an improved LayoutLMv3 network to jointly model text content, visual structure, and structure template information, forming multi-source feature interaction and structure consistency scoring. Combined with the structure discrimination output head, it generates structure anomaly categories, structure verification pass labels, and structure missing prompts. In the verification conclusion generation module, it outputs structured verification conclusions in JSON format, including structure anomaly regions, anomaly categories, scoring results, and verification labels, meeting the requirements for intelligent, interpretable, and high-precision document verification.
[0018] In summary, this invention achieves integrated modeling at the image level, structural level, and semantic level through multi-scale structural modeling and joint judgment of semantic structure. This effectively solves the problems of difficult identification of structural errors, rigid field matching rules, and unclear classification of anomaly types in existing archive verification, thereby improving the accuracy and universality of verification. Attached Figure Description
[0019] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a schematic diagram of a method and system for verifying archive content based on pattern recognition proposed in this invention; Figure 2 This is a flowchart of the improved HRNet network structure in a pattern recognition-based document content verification method and system proposed in this invention. Figure 3 This is a flowchart of an improved LayoutLMv3 network structure in a pattern recognition-based document content verification method and system proposed in this invention. Detailed Implementation
[0020] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.
[0021] refer to Figures 1-3 A method for verifying the content of archives based on pattern recognition includes the following steps: Step 1: Obtain the original image of the document to be verified; Step 2: Standardize the original archival images to generate standard archival images; Step 3: Perform text detection and text recognition on standard archival images to obtain semantic region identifiers of archival text content and structure; Step 4: Input the standard archive image and structural semantic region identifiers into the improved HRNet network, perform multi-resolution structural feature extraction and structural difference enhancement modeling, and generate a set of regional structural feature vectors and structural pattern feature maps. The improved HRNet network includes an initial feature extraction module, a multi-resolution parallel convolution module, a cross-branch feature fusion module, a structural consistency modeling module, and a structural difference enhancement module. Step 5: Semantically aggregate the structural pattern feature maps to construct visual structure embedding vectors; Step Six: Input the archive text content, regional structure feature vector set, and visual structure embedding vector into the improved LayoutLMv3 network, perform regional consistency attention modeling and structure discrimination inference, and generate archive structure discrimination results; the improved LayoutLMv3 network includes a text semantic embedding module, a regional consistency attention module, a regional structure scoring module, and a structure discrimination output head; Step 7: Based on the results of the archive structure assessment, generate an archive content verification conclusion.
[0022] In this embodiment, step two specifically includes: The standardization process includes image resolution normalization, image orientation correction, grayscale conversion, and image noise suppression. The image resolution normalization uses bilinear interpolation to resample the resolution of the original archive image to a set target resolution, generating a normalized archive image. The image orientation correction specifically involves: constructing an orientation histogram based on the edge orientation of the normalized archival image, identifying the main orientation angle of the normalized archival image, and rotating the normalized archival image counterclockwise according to the main orientation angle to generate an orientation-corrected archival image; The grayscale conversion specifically involves: obtaining the R channel value, G channel value, and B channel value of each pixel position in the orientation-corrected archive image, performing a weighted average according to a preset weighting coefficient to generate the corresponding grayscale value, and constructing a grayscale archive image based on the grayscale value; Image noise is suppressed in grayscale archival images using Gaussian filtering to obtain standard archival images.
[0023] In this embodiment, step three specifically includes: Text detection is performed on standard archival images to obtain all text candidate regions in the image; the text candidate regions are represented by the coordinates of the minimum bounding rectangle, including the x-coordinate of the upper left corner, the y-coordinate of the upper left corner, the x-coordinate of the lower right corner, and the y-coordinate of the lower right corner; Identify the text characters in each text candidate region, obtain the text character sequence, and then combine the text character sequences of all text candidate regions into the archive text content in order; Based on the vertical position ratio, area ratio, and character density of each text candidate region in the standard archival image, determine the structural semantic region and its identifier for each text candidate region. The structural semantic region and its identifier specifically include title: T, body text: B, table: L, and signature: S; The vertical position ratio is the ratio of the vertical coordinate of the upper left corner of the text candidate region to the height of the standard archive image; The area ratio is the ratio of the area of the candidate text region to the area of the standard archive image; The character density is the ratio of the number of characters in a text candidate region to the area of the text candidate region.
[0024] In this embodiment, step four specifically includes: In the initial feature extraction module, a two-dimensional convolution operation with a kernel size of 3×3 and a downsampling operation with a stride of 2 are sequentially performed on the standard archive image to obtain the initial structural feature map; The initial structural feature map is input into a multi-resolution parallel convolution module, which includes parallel high-resolution branches, medium-resolution branches and low-resolution branches. The high-resolution branch generates a high-resolution structural feature map by passing the initial structural feature map through two layers of 3×3 two-dimensional convolution, batch normalization, and ReLU activation function; The medium-resolution branch generates a medium-resolution structural feature map from the high-resolution structural feature map by downsampling with a stride of 2 and two layers of 3×3 convolution. The low-resolution branch generates a low-resolution structural feature map by downsampling the medium-resolution structural feature map with a stride of 2 and two 3×3 convolutions. In the cross-branch feature fusion module, the low-resolution structural feature map is upsampled using bilinear interpolation to obtain the upsampled structural feature map, and the high-resolution structural feature map is downsampled with a step size of 2 to obtain the downsampled structural feature map. The upsampled structural feature map, the medium-resolution structural feature map, and the downsampled structural feature map are respectively channel-aligned by 1×1 convolution, and then fused by pixel-by-pixel summation to obtain a fused structural feature map. In the structural consistency modeling module, each text candidate region is mapped to the fused structural feature map space through coordinate transformation; Based on the semantic region identifiers of each structure, a title mask matrix, a body text mask matrix, a table mask matrix, and a signature mask matrix are constructed respectively; For example, the construction process of the text mask matrix is as follows: set the pixel position in all text candidate regions marked as B in the fused structural feature map to 1, otherwise set it to 0; Based on the title mask matrix, body text mask matrix, table mask matrix, and signature mask matrix, feature aggregation is performed on the fused structural feature map through regional average pooling to obtain title structure feature vectors, body text structure feature vectors, table structure feature vectors, and signature structure feature vectors, which are then combined into a regional structure feature vector set. A structure template library is set up, which includes a reference structure template feature map and a reference structure feature vector set of the file to be verified; In the structural differential enhancement module, the feature map of the reference structural template of the file to be verified is obtained; Align the fused structural feature map with the reference structural template feature map in both spatial and channel dimensions, and perform pixel-by-pixel differencing to obtain a structural difference feature map. Then, fuse the structural difference feature map with the fused structural feature map pixel-by-pixel to obtain a structural pattern feature map.
[0025] In this invention, a structural difference feature map is injected as a structural error signal into the fused structural feature map. Its function is to explicitly capture structural deviation patterns by comparing the differences in spatial arrangement and channel semantics between the archive to be verified and the reference structural template. This differential enhancement process allows the differentially enhanced structural feature map to retain the actual structural information of the archive in the original fused structural feature map, while superimposing the difference features between it and the standard structure, thus enhancing the sensitivity and discrimination ability for structurally abnormal regions.
[0026] In this invention, the improved HRNet network, while maintaining the advantages of multi-resolution parallel convolution and cross-branch feature fusion, introduces a structural consistency modeling module based on structural semantic region identification. By mapping text candidate regions to the fused structural feature map and constructing mask matrices corresponding to titles, body text, tables, and signatures, the network can explicitly perceive the spatial distribution and boundary features of different archival structural regions, thereby improving its ability to discriminate the layout structure of archival pages. A structural template library is introduced, and the fused structural feature map is aligned and pixel-wise differencing is performed with the reference structural template feature map in the structural difference enhancement module. This allows the improved HRNet network to not only learn the structural features of the current archive but also characterize the differences between it and the standard structural template, thus strengthening its response to abnormal patterns such as structural missing and misaligned structures. Furthermore, by pixel-wise fusion of the structural difference feature map and the fused structural feature map, a structural pattern feature map is constructed, achieving joint modeling of structural consistency features and structural difference features. This significantly enhances the robustness and discriminative ability of the improved HRNet network to complex archival layout changes and irregular structural anomalies.
[0027] In this embodiment, step five specifically includes: Global average pooling is performed on the structural pattern feature map in the spatial dimension to obtain the global structural feature vector; The global structural feature vector is linearly transformed using a trainable visual structural weight matrix and a visual structural bias vector to generate a visual structural embedding vector.
[0028] In this embodiment, step six specifically includes: The text semantic embedding module extracts semantic features of the archival text content through a pre-trained RoBERTa model to obtain an archival text embedding sequence; the archival text embedding sequence includes several token vectors. The archival text embedding sequence and the visual structure embedding vector are concatenated to obtain a joint embedding sequence; In the region consistency attention module, multi-head attention operations are performed on the joint embedding sequence to generate a fused attention embedding sequence, specifically: Set the number of multi-head attention operations. In each attention head, the joint embedding sequence is transformed into a query matrix, a key matrix, and a value matrix through three sets of trainable linear mapping matrices. Perform matrix multiplication on the query matrix and the key matrix, and scale the matrix by the dimension of the key matrix to obtain the original attention score matrix. Construct the attention-guided bias matrix; The original attention score matrix and the attention guidance bias matrix are added element by element, and then normalized using the Softmax function to obtain the attention weight matrix for each attention head. Perform matrix multiplication on the attention weight matrix and value matrix of each attention head to obtain the attention output feature matrix; The attention output feature matrices of all attention heads are concatenated and then feature-mapped through a trainable linear mapping layer to obtain a fused attention embedding sequence. The fused attention embedding sequence includes four fused attention embedding vectors, which represent the fused semantic features of the title, body text, table, and signature, respectively. In the regional structure scoring module, the reference structure feature vector set of the archive to be verified is obtained from the structure template library; The reference structural feature vector set is compared with the regional structural feature vector set one by one. The structural consistency score of each structural semantic region is calculated by using cosine similarity, and the structural consistency score vector is formed. The structural consistency score includes the title consistency score, the body text consistency score, the table consistency score, and the signature consistency score. The structural consistency score vector and the fusion attention embedding sequence are input into the structural discrimination output head to generate the archive structural discrimination result, which includes the structural anomaly category, the structural verification passed label and the structural missing prompt.
[0029] In this invention, the improved LayoutLMv3 network concatenates visual structure embedding vectors with archival text embedding sequences to construct a joint embedding sequence. This allows the improved LayoutLMv3 network to explicitly incorporate global and regional structural information of archival pages during text semantic modeling, thus avoiding the problem of relying solely on text order or implicit layout features for reasoning. In the regional consistency attention module, an attention-guided bias matrix is introduced, and the attention weights between different tokens are directionally enhanced or suppressed based on the structural semantic region identifier. This enables multi-head attention computation to focus on semantic consistency modeling within the same structural semantic region, while suppressing irrelevant interference across regions, thereby improving the ability to distinguish structural regions such as titles, body text, tables, and signatures. In the regional structure scoring module, a region-by-region consistency score is performed on the reference structural feature vector set and the regional structural feature vector set based on cosine similarity. The structural consistency score vector and the fused attention embedding sequence are jointly input to the structural discrimination output head, achieving joint discrimination of semantic features, visual structural features, and template priors. This significantly enhances the recognition stability and discrimination reliability of complex archival problems such as structural anomalies, structural missing features, and structural misalignments.
[0030] In this embodiment, constructing the attention-guided bias matrix specifically includes: Based on the i-th and j-th vectors in the joint embedding sequence, the corresponding structural semantic region identifiers are obtained respectively; If the structural semantic region identifier to which the i-th vector belongs is the same as the structural semantic region identifier to which the j-th vector belongs, then the element in the i-th row and j-th column of the attention-guided bias matrix is set as a positive bias value. If the structural semantic region identifier to which the i-th vector belongs is different from the structural semantic region identifier to which the j-th vector belongs, then the element in the i-th row and j-th column of the attention guidance bias matrix is set as the suppression bias value. Both the forward bias value and the suppression bias value are preset constants. The forward bias value ranges from [0.5, 1.0], and the suppression bias value ranges from [−1.0, 0].
[0031] In this invention, positive bias and suppression bias are used to adjust the information flow and intensity in the structural consistency attention mechanism, guiding the improved LayoutLMv3 network to focus more on the correlation between joint embedding vectors within the same structural semantic region during the feature fusion stage, and suppressing irrelevant interference information between different structural semantic regions. Specifically, when the i-th and j-th vectors both come from the text semantic region, the corresponding position in the attention guidance bias matrix is set to a positive bias of 0.8 to strengthen the attention connection between the pair of vectors, thereby improving the fusion depth of information within the same semantic region. Conversely, when the i-th vector comes from the text semantic region and the j-th vector comes from the table semantic region, setting this position to a suppression bias of −0.7 can significantly reduce the attention response between different regions and reduce the impact of structural interference on the verification and discrimination results. Setting the positive bias range to [0.5, 1.0] ensures a strong attention aggregation ability between similar regions, while setting the suppression bias to [−1.0, 0] allows for flexible adjustment of the suppression intensity of cross-regional attention, achieving more refined structural consistency modeling.
[0032] In this embodiment, the generation of the archive structure discrimination result specifically includes: Each fused attention embedding vector is used to generate a hidden feature vector through a linear mapping and GELU activation; The hidden feature vectors are used to generate the logits values of structural anomalies in the current region through linear mapping. The structural anomaly logits value is normalized using the Softmax function to obtain the structural anomaly probability; Set consistency and anomaly thresholds, and perform anomaly detection for each structural semantic region: If the structural consistency score of the current structural semantic region is lower than the consistency threshold, or the probability of structural anomaly is greater than the anomaly threshold, then the current structural semantic region is determined to be a structural anomaly region and a structural anomaly category is marked; the structural anomaly categories include missing title, abnormal text format, broken table structure, and offset or missing signature position; If the structural consistency score of the current structural semantic region is greater than or equal to the consistency threshold, and the structural anomaly probability is less than or equal to the anomaly threshold, then the current structural semantic region is determined to be a structurally normal region, and a structural verification pass label is output. If two or more structural semantic regions simultaneously satisfy the consistency score being lower than the consistency threshold and the structural anomaly probability being greater than the anomaly threshold, then the current file to be verified is determined to have a structural missing risk, and a structural missing warning and a set of structural anomaly regions are output.
[0033] In this embodiment, the verification conclusion of the archive content specifically includes the structural consistency score, structural anomaly probability, structural anomaly category or structural verification pass label, structural anomaly area and structural missing prompt for each structural semantic region in the archive to be verified, and the archive content verification conclusion is output in JSON format.
[0034] A pattern recognition-based document content verification system includes: Image acquisition module: Used to acquire the original images of the documents to be verified. The image preprocessing module is used to standardize the original archival images and generate standard archival images. The structure extraction module is used to perform text detection and text recognition on standard archival images; The structural feature modeling module is used to generate regional structural feature vector sets and structural pattern feature maps through the improved HRNet network; The visual structure building module is used to construct visual structure embedding vectors; The structure discrimination modeling module is used to generate the file structure discrimination results of the files to be verified through the improved LayoutLMv3 network; The verification conclusion generation module is used to generate verification conclusions for the archive content.
[0035] Example 1 To verify the feasibility of this invention in practice, it was applied to a batch review task of the structural compliance of government archives at an archives management center. In this task, a large number of electronic archives from different departments, with varying formats, needed to undergo structural verification before archiving to ensure they conformed to a unified template specification. Due to the complex structures of document formats, such as scanned copies, PDF-to-image conversions, nested tables, and inconsistent signature placements, traditional review systems based on OCR and field matching rules have significant shortcomings in terms of recognition accuracy and structural compliance judgment, resulting in a large amount of manual review and a high rate of missed detections and false judgments.
[0036] In practical applications, this invention first receives the original archival images to be verified through an image acquisition module. The image format is JPEG or TIFF, with resolutions ranging from 200dpi to 600dpi. The image preprocessing module performs resolution normalization, orientation correction, grayscale conversion, and Gaussian filtering for noise reduction, generating standardized archival images that eliminate structural discrimination biases caused by differences in acquisition equipment or formats. Text detection and OCR recognition are then performed on the standard archival images, and structural semantic regions are automatically annotated based on the position, area, and character density of text boxes. The standard archival images are then input into an improved HRNet network for structural feature extraction, outputting structural pattern feature maps and regional structural feature vector sets. Visual structure embedding vectors are generated by global average pooling of the structural pattern feature maps and input along with the archival text content and structural feature vectors into an improved LayoutLMv3 network to generate a structural consistency score and structural anomaly probability for each region. In the output stage, the system outputs the archival content verification conclusion in JSON format.
[0037] To verify the performance of the present invention, 5,000 archival image samples actually collected by the archives management center were selected as test data. The present invention was compared with comparison scheme A: traditional OCR + rule judgment and comparison scheme B: only using improved HRNet modeling for structural verification. The experimental results are shown in Table 1.
[0038] Table 1. Comparison of Structural Verification Performance between the Invention and the Comparative Solution
[0039] As shown in Table 1, the present invention significantly outperforms existing comparative schemes in the task of verifying the structure of archival content. In terms of verification accuracy, the present invention achieves 96.7%, which is 13.2 percentage points higher than comparative scheme A and 5.9 percentage points higher than comparative scheme B, indicating that the present invention has higher robustness and generalization ability in multimodal joint modeling and structural semantic fusion. Regarding anomaly detection rate, the present invention achieves 94.2%, significantly better than comparative scheme A's 72.4% and comparative scheme B's 81.6%, indicating that the present invention can more effectively identify complex structural anomalies such as missing titles, offset signatures, and misaligned tables. In terms of structural misjudgment rate, the present invention controls it at 1.8%, far lower than comparative scheme A's 9.6% and comparative scheme B's 4.2%, demonstrating the accuracy of the present invention in structural consistency scoring and anomaly probability discrimination mechanisms.
[0040] Furthermore, in terms of system performance, the average positioning time of this invention is 215ms, significantly better than the 410ms of comparative scheme A and the 292ms of comparative scheme B, indicating that this invention has stronger real-time performance and deployment efficiency. This invention supports structured output of verification conclusions, with a 100% structuring rate, significantly improving the usability of results compared to 41% of comparative scheme A and 73% of comparative scheme B, facilitating subsequent system integration and archiving review processes. Regarding the accuracy of abnormal area positioning, this invention achieves 93.6%, compared to 64.1% of comparative scheme A and 78.7% of comparative scheme B, demonstrating a significant advantage in automatically marking abnormal structural areas, greatly improving the efficiency of manual review and the operability of anomaly tracing.
[0041] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for verifying the content of archives based on pattern recognition, characterized in that, Includes the following steps: Step 1: Obtain the original image of the document to be verified; Step 2: Standardize the original archival images to generate standard archival images; Step 3: Perform text detection and text recognition on standard archival images to obtain semantic region identifiers of archival text content and structure; Step 4: Input the standard archive image and structural semantic region identifiers into the improved HRNet network, perform multi-resolution structural feature extraction and structural difference enhancement modeling, and generate a set of regional structural feature vectors and structural pattern feature maps. The improved HRNet network includes an initial feature extraction module, a multi-resolution parallel convolution module, a cross-branch feature fusion module, a structural consistency modeling module, and a structural difference enhancement module. Step 5: Semantically aggregate the structural pattern feature maps to construct visual structure embedding vectors; Step Six: Input the archive text content, regional structure feature vector set, and visual structure embedding vector into the improved LayoutLMv3 network, perform regional consistency attention modeling and structure discrimination inference, and generate archive structure discrimination results; the improved LayoutLMv3 network includes a text semantic embedding module, a regional consistency attention module, a regional structure scoring module, and a structure discrimination output head; Step 7: Based on the results of the archive structure assessment, generate an archive content verification conclusion.
2. The method for verifying archive content based on pattern recognition according to claim 1, characterized in that, Step two specifically includes: The standardization process includes image resolution normalization, image orientation correction, grayscale conversion, and image noise suppression. The image resolution normalization uses bilinear interpolation to resample the resolution of the original archive image to a set target resolution, generating a normalized archive image. The image orientation correction specifically involves: constructing an orientation histogram based on the edge orientation of the normalized archival image, identifying the main orientation angle of the normalized archival image, and rotating the normalized archival image counterclockwise according to the main orientation angle to generate an orientation-corrected archival image; The grayscale conversion specifically involves: obtaining the R channel value, G channel value, and B channel value of each pixel position in the orientation-corrected archive image, performing a weighted average according to a preset weighting coefficient to generate the corresponding grayscale value, and constructing a grayscale archive image based on the grayscale value; Image noise is suppressed in grayscale archival images using Gaussian filtering to obtain standard archival images.
3. The method for verifying archive content based on pattern recognition according to claim 1, characterized in that, Step three specifically includes: Perform text detection on standard archival images to obtain all text candidate regions in the image; Identify the text characters in each text candidate region, obtain the text character sequence, and then combine the text character sequences of all text candidate regions into the archive text content in order; Based on the vertical position ratio, area ratio, and character density of each text candidate region in the standard archival image, determine the structural semantic region and its identifier for each text candidate region. The structural semantic regions and their identifiers specifically include title: T, body: B, table: L, and signature: S.
4. The method for verifying archive content based on pattern recognition according to claim 1, characterized in that, Step four specifically includes: In the initial feature extraction module, a two-dimensional convolution operation with a kernel size of 3×3 and a downsampling operation with a stride of 2 are sequentially performed on the standard archive image to obtain the initial structural feature map; The initial structural feature map is input into a multi-resolution parallel convolution module, which includes parallel high-resolution branches, medium-resolution branches and low-resolution branches. The high-resolution branch generates a high-resolution structural feature map by passing the initial structural feature map through two layers of 3×3 two-dimensional convolution, batch normalization, and ReLU activation function; The medium-resolution branch generates a medium-resolution structural feature map from the high-resolution structural feature map by downsampling with a stride of 2 and two layers of 3×3 convolution. The low-resolution branch generates a low-resolution structural feature map by downsampling the medium-resolution structural feature map with a stride of 2 and two 3×3 convolutions. In the cross-branch feature fusion module, the low-resolution structural feature map is upsampled using bilinear interpolation to obtain the upsampled structural feature map, and the high-resolution structural feature map is downsampled with a step size of 2 to obtain the downsampled structural feature map. The upsampled structural feature map, the medium-resolution structural feature map, and the downsampled structural feature map are respectively channel-aligned by 1×1 convolution, and then fused by pixel-by-pixel summation to obtain a fused structural feature map. In the structural consistency modeling module, each text candidate region is mapped to the fused structural feature map space through coordinate transformation; Based on the semantic region identifiers of each structure, a title mask matrix, a body text mask matrix, a table mask matrix, and a signature mask matrix are constructed respectively; Based on the title mask matrix, body text mask matrix, table mask matrix, and signature mask matrix, feature aggregation is performed on the fused structural feature map through regional average pooling to obtain title structure feature vectors, body text structure feature vectors, table structure feature vectors, and signature structure feature vectors, which are then combined into a regional structure feature vector set. A structure template library is set up, which includes a reference structure template feature map and a reference structure feature vector set of the file to be verified; In the structural differential enhancement module, the feature map of the reference structural template of the file to be verified is obtained; Align the fused structural feature map with the reference structural template feature map in both spatial and channel dimensions, and perform pixel-by-pixel differencing to obtain a structural difference feature map. Then, fuse the structural difference feature map with the fused structural feature map pixel-by-pixel to obtain a structural pattern feature map.
5. The method for verifying archive content based on pattern recognition according to claim 1, characterized in that, Step five specifically includes: Global average pooling is performed on the structural pattern feature map in the spatial dimension to obtain the global structural feature vector; The global structural feature vector is linearly transformed using a trainable visual structural weight matrix and a visual structural bias vector to generate a visual structural embedding vector.
6. The method for verifying archive content based on pattern recognition according to claim 1, characterized in that, Step six specifically includes: The text semantic embedding module extracts semantic features of the archival text content through a pre-trained RoBERTa model to obtain an archival text embedding sequence; the archival text embedding sequence includes several token vectors. The archival text embedding sequence and the visual structure embedding vector are concatenated to obtain a joint embedding sequence; In the region consistency attention module, multi-head attention operations are performed on the joint embedding sequence to generate a fused attention embedding sequence, specifically: Set the number of multi-head attention operations. In each attention head, the joint embedding sequence is transformed into a query matrix, a key matrix, and a value matrix through three sets of trainable linear mapping matrices. Perform matrix multiplication on the query matrix and the key matrix, and scale the matrix by the dimension of the key matrix to obtain the original attention score matrix. Construct the attention-guided bias matrix; The original attention score matrix and the attention guidance bias matrix are added element by element, and then normalized using the Softmax function to obtain the attention weight matrix for each attention head. Perform matrix multiplication on the attention weight matrix and value matrix of each attention head to obtain the attention output feature matrix; The attention output feature matrices of all attention heads are concatenated and then feature-mapped through a trainable linear mapping layer to obtain a fused attention embedding sequence; the fused attention embedding sequence includes four fused attention embedding vectors. In the regional structure scoring module, the reference structure feature vector set of the archive to be verified is obtained from the structure template library; The reference structural feature vector set is compared with the regional structural feature vector set one by one. The structural consistency score of each structural semantic region is calculated by cosine similarity and the structural consistency score vector is formed. The structural consistency score vector and the fusion attention embedding sequence are input into the structural discrimination output head to generate the archive structural discrimination result, which includes the structural anomaly category, the structural verification passed label and the structural missing prompt.
7. The method for verifying archive content based on pattern recognition according to claim 6, characterized in that, The construction of the attention-guided bias matrix specifically includes: Based on the i-th and j-th vectors in the joint embedding sequence, the corresponding structural semantic region identifiers are obtained respectively; If the structural semantic region identifier to which the i-th vector belongs is the same as the structural semantic region identifier to which the j-th vector belongs, then the element in the i-th row and j-th column of the attention-guided bias matrix is set as a positive bias value. If the structural semantic region identifier to which the i-th vector belongs is different from the structural semantic region identifier to which the j-th vector belongs, then the element in the i-th row and j-th column of the attention guidance bias matrix is set as the suppression bias value. Both the forward bias value and the suppression bias value are preset constants. The forward bias value ranges from [0.5, 1.0], and the suppression bias value ranges from [−1.0, 0].
8. The method for verifying archive content based on pattern recognition according to claim 6, characterized in that, The generated archive structure discrimination result specifically includes: Each fused attention embedding vector is used to generate a hidden feature vector through a linear mapping and GELU activation. The hidden feature vector is then used to generate the structural anomaly logits value of the current region through a linear mapping. The structural anomaly logits value is then normalized through the Softmax function to obtain the structural anomaly probability. Set consistency and anomaly thresholds, and perform anomaly detection for each structural semantic region: If the structural consistency score of the current structural semantic region is lower than the consistency threshold, or the structural anomaly probability is greater than the anomaly threshold, then the current structural semantic region is determined to be a structural anomaly region and the structural anomaly category is marked. If the structural consistency score of the current structural semantic region is greater than or equal to the consistency threshold, and the structural anomaly probability is less than or equal to the anomaly threshold, then the current structural semantic region is determined to be a structurally normal region, and a structural verification pass label is output. If two or more structural semantic regions simultaneously satisfy the consistency score being lower than the consistency threshold and the structural anomaly probability being greater than the anomaly threshold, then the current file to be verified is determined to have a structural missing risk, and a structural missing warning and a set of structural anomaly regions are output.
9. The method for verifying archive content based on pattern recognition according to claim 1, characterized in that, The verification conclusion of the archive content specifically includes the structural consistency score, structural anomaly probability, structural anomaly category or structural verification pass label, structural anomaly area and structural missing prompt for each structural semantic region in the archive to be verified, and outputs the archive content verification conclusion in JSON format.
10. A pattern recognition-based archival content verification system, comprising executing the pattern recognition-based archival content verification method according to any one of claims 1 to 9, characterized in that, include: Image acquisition module: Used to acquire the original images of the documents to be verified. The image preprocessing module is used to standardize the original archival images and generate standard archival images. The structure extraction module is used to perform text detection and text recognition on standard archival images; The structural feature modeling module is used to generate regional structural feature vector sets and structural pattern feature maps through the improved HRNet network; The visual structure building module is used to construct visual structure embedding vectors; The structure discrimination modeling module is used to generate the file structure discrimination results of the files to be verified through the improved LayoutLMv3 network; The verification conclusion generation module is used to generate verification conclusions for the archive content.