High-concurrency and low-latency id card analysis system based on knowledge graph optimization verification
By using a knowledge graph-based ID card parsing system, the problems of accuracy and stability in ID card recognition under complex imaging conditions and high-concurrency scenarios were solved, achieving high accuracy and low latency in ID card recognition, and improving the interpretability and verifiability of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JIANGSU SUNING BANK CO LTD
- Filing Date
- 2026-01-26
- Publication Date
- 2026-05-29
AI Technical Summary
Existing ID card recognition systems struggle to stably output high-quality structured information under complex imaging conditions, and they also struggle to guarantee system stability and latency performance in high-concurrency scenarios.
A high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification is adopted, including an adaptive ID card image correction module, a text detection and recognition module, a key information extraction module, and a knowledge graph-assisted verification module. Through multi-layer feature pyramid network, perspective transformation matrix correction, and knowledge graph-assisted verification, the system achieves standardization and error correction verification of ID card images.
It significantly improves text readability and recognition accuracy in complex scenarios, enhances the interpretability and verifiability of the system, provides high-concurrency and low-latency ID card recognition capabilities, and ensures the stability and latency performance of the system in high-concurrency environments.
Smart Images

Figure CN122115223A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ID card parsing system technology, specifically to a high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification. Background Technology
[0002] With the rapid development of internet finance, e-government, remote account opening by telecom operators, and internet-based travel, remote identity verification based on resident ID cards has become a key link in online business risk control and compliance review. ID card recognition systems typically rely on Optical Character Recognition (OCR) technology to perform layout analysis, text detection and recognition on document images, and combine rule-based validation to achieve automatic structuring of document information.
[0003] Existing mainstream commercial OCR platforms (such as Tencent OCR and Alibaba OCR) can already achieve high recognition accuracy for fields such as ID card numbers, names, genders, ethnicities, addresses, issuing authorities, and validity periods under standard shooting conditions, and are widely used in various business systems through SDKs or cloud APIs. Meanwhile, the academic community has proposed numerous deep learning models focusing on text detection, text recognition, layout analysis, and key information extraction (KIE), continuously improving the overall performance of document recognition.
[0004] However, in real-world business scenarios, ID card images are often not ideal for capture: 1. The user may have taken the photo in a strong light environment, causing obvious reflection on the surface of the document; 2. The document has physical damage such as creases, wear, stains, and bending, which introduces severe geometric distortion and partial obstruction; 3. Taking photos of mobile phone screens and computer monitors a second time will produce moiré patterns, noise, and compression artifacts; 4. Incorrect user posture and camera angle can cause documents to be tilted, have perspective distortion, and be out of focus in some areas.
[0005] Under such complex imaging conditions, the traditional pipeline of "image preprocessing + OCR recognition + simple rule verification" is difficult to reliably output high-quality structured identity information. It is prone to problems such as missing or incorrect address fields, incorrect number recognition, inconsistencies between issuing authorities and administrative divisions, and semantic mismatches between fields, which in turn affect the pass rate of real person authentication and the overall risk control effect.
[0006] Meanwhile, as business scales up, ID card recognition systems often need to support high-concurrency scenarios, placing higher demands on the system's overall latency, concurrency capacity, stability, and fault degradation capabilities. Simply relying on engineering experience for simple capacity expansion and caching optimization is insufficient to theoretically guarantee that the system can still provide stable and predictable service quality under peak pressure. Summary of the Invention
[0007] The purpose of this invention is to address the shortcomings of existing technologies by providing a high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification.
[0008] To achieve the above objectives, this invention provides a high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification, comprising: An adaptive ID card image correction module is used to process ID card images to form standardized images; A text detection and recognition module is used to detect and recognize ID card text information from the standardized image; The key information extraction module is used to parse the key fields of the ID card from the text information of the ID card; The knowledge graph-assisted verification module constructs a knowledge graph covering four levels of administrative divisions across the country, and performs fast node lookup, multi-level link similarity verification, and logical verification on the address field and related information in the key fields, thereby realizing error correction and verification of the address in the key fields. The dynamic load balancing and high-concurrency optimization module is used to achieve high-concurrency, low-latency processing.
[0009] Furthermore, the adaptive ID card image correction module processes the ID card image in the following ways: A multi-layer feature pyramid network structure is adopted to extract image features at multiple scales. The features at each scale are unified into a 256-dimensional feature representation through horizontal convolution, and then feature fusion is performed. A comprehensive quality assessment function is constructed, and resolution mapping is performed based on the quality assessment score calculated by the quality assessment function to select the optimal processing resolution; The location of the center point of an ID card is predicted by heatmap regression. The precise positional offset of the center point is predicted, compensating for the quantization error caused by downsampling. Starting from the detected center point, the relative offset vectors of the four corner points are regressed to form an 8-dimensional regression target. , These are the horizontal and vertical offsets of the k-th corner point relative to the center point, respectively, where k = 1, 2, 3, 4; The perspective transformation matrix is calculated based on the four detected corner points, and coarse geometric correction is performed using the perspective transformation matrix. Then, text line detection is performed on the result after coarse geometric correction to extract the geometric information of the text region. The overall tilt angle is obtained by calculating the main direction angle of the text line. Outliers are removed by median filtering. When the absolute value of the tilt angle exceeds the set angle threshold, precise angle correction is performed by rotation transformation.
[0010] Furthermore, the feature fusion method is as follows: ; ; ; ; ; in, The characteristics after fusion Candidate features The weighting coefficients, It is an exponential function. This is a global average pooling operation. The features are those processed by global average pooling. This is for fully connected layer processing. To use lateral convolution processing, For real numbers, Features height, Features width, For the first Features extracted from layered network structures The input image.
[0011] Furthermore, the quality assessment function is expressed as: ; in, For the input image The quality assessment score, Rate the clarity. The brightness and contrast ratio are rated. For noise level estimation, , , These are the weighting coefficients; The resolution mapping method based on the quality assessment score calculated using the quality assessment function is as follows: ; in, This refers to the mapped resolution.
[0012] Furthermore, the perspective transformation matrix is calculated as follows: ; in, The calculated perspective transformation matrix, This is a function in the OpenCV library used to calculate the perspective transformation matrix. To obtain the coordinates of the four corner points, These are the coordinates of the corner points of a standard rectangle.
[0013] Furthermore, the text detection and recognition module is based on the PP-OCRv5_server_det detection model and the PP-OCRv5_server_rec recognition model. It constructs a special training dataset for ID cards and performs incremental fine-tuning on the basis of a general OCR dataset to achieve the detection and recognition of ID card text.
[0014] Furthermore, the key information extraction module parses the various key fields of the ID card from the ID card text information in the following way: Establish a field position mapping system based on the standard layout of the ID card to determine the standard position area corresponding to each field; Based on the format characteristics of each field of the ID card, a dedicated regular expression matching rule system was designed to identify fields within the standard location area; Construct a multi-level error correction system covering label fields, organization names, confusion between numbers and letters, and similar-looking Chinese characters to correct errors in the identified fields; Establish a logical consistency verification mechanism between fields and improve the overall extraction accuracy through multi-dimensional cross-validation; The extracted field results are uniformly converted into standardized structured data, and the field confidence score, the overall certificate joint confidence score, and the field / overall certificate risk label are calculated. The data is then output in JSON format for use by business systems.
[0015] Furthermore, the knowledge graph-assisted verification module performs error correction and verification on the addresses in the key fields in the following manner: Construct a four-level administrative division knowledge graph of province, city, district / county, and street; Design a fast node lookup mechanism based on hash indexes to achieve millisecond-level node existence determination; When a graph node search fails, a similarity verification mechanism based on multi-level links is triggered to verify the logical consistency of multi-level addresses through the membership relationship of the knowledge graph. When a superior place name contains uncommon characters, the system automatically checks the matching of the subordinate place name as an auxiliary verification. When a graph node search fails or the validity period logic is abnormal, a verification is triggered. The address or validity period that passes the verification is automatically replaced with the original recognition result. For addresses that cannot match any graph node or for abnormal validity periods, the system retains the original recognition result but lowers the overall confidence score. The knowledge graph is continuously optimized by adding new data and updating the mapping of rare characters and validity period rules.
[0016] Furthermore, the dynamic load balancing and high-concurrency optimization module achieves high-concurrency, low-latency processing in the following specific ways: Triton's built-in dynamic batch processing function adaptively adjusts the batch size according to the request queue length, dynamically balancing low latency and high throughput. Dynamic management and load balancing of multiple model instances based on the Kubernetes container cloud platform; Set the fuse triggering conditions and fault recovery strategies to achieve a three-state fuse mode and prevent cascading faults from affecting system stability; To address the high-frequency query requirements for address and validity period verification, memory optimization and caching strategies were designed. A four-level priority queue is set up to ensure the quality of core business services; Implement load-based automatic scaling using Kubernetes HPA; Establish a real-time monitoring system based on native K8s monitoring, supporting dynamic parameter adjustment and automatic anomaly handling.
[0017] Beneficial effects: 1. This invention constructs an image quality assessment model to classify and score imaging degradation types such as reflection, creases, blur, and moiré patterns, and selects corresponding geometric and illumination correction strategies based on this. The correction process uses an image transformation model with a clear mathematical form to perform multi-scale and regional correction of projection distortion, local curvature, etc., thereby significantly improving the readability and recognizability of text in complex scenes. 2. This invention models ID card fields, administrative division nodes, address fragments, etc., as nodes in a graph structure, and abstracts the spatial, semantic, and hierarchical relationships between them as directed edges. Based on this, a graph structure reasoning model is constructed to perform link reasoning and error correction and completion on the address field. This process not only provides a clear mathematical expression for the cost function of nodes, edges, and paths, but also analyzes the time complexity and convergence of the reasoning process, providing a theoretical basis for the correctness and robustness of address resolution. 3. This invention proposes a complete chain of "OCR output - structured fields - knowledge graph constraints - corrected candidates - optimal solution". It regards the OCR output as the observation result of potential real fields, constructs a set of constraints and prior probabilities between fields through a knowledge graph, models the field correction process as an optimization problem under constraints, and gives the objective function and solution strategy. Through this framework, the ability of knowledge graph to correct recognition results can be theoretically explained, realizing consistency checks and automatic error correction of fields such as address, issuing authority, and number, and enhancing the interpretability and verifiability of the system. 4. This invention performs probabilistic modeling of single-field confidence and introduces inter-field correlation on this basis to construct a joint confidence fusion model, which is used to evaluate the overall credibility of the whole ID card recognition result. By formally defining the relationship between joint confidence and business risk strategy, it can provide quantifiable basis for manual review triggering and risk control strategy configuration, making up for the shortcomings of existing solutions that "only rely on experience thresholds". 5. This invention treats a high-concurrency ID card recognition system as a service network composed of multiple queuing nodes. It uses queuing theory to model the request arrival process, service time distribution, batch processing window, and caching strategy, deriving theoretical expressions for system throughput, average waiting time, and P90 / P99 latency. Based on this, this invention provides design principles for concurrent scheduling and load balancing strategies, analyzes the convergence conditions of blocking and degradation mechanisms, and implements deployment by combining engineering methods such as container orchestration and GPU inference services. This ensures that system performance optimization no longer relies solely on experience-based tuning but has an analyzable and verifiable theoretical foundation.
[0018] 6. This invention provides a modular architecture that can be used for end-to-end comparison and ablation experiments. It can be compared with mainstream OCR schemes under the same dataset and evaluation metrics. By removing the image correction module, knowledge graph module, address link reasoning module, etc., ablation experiments can be carried out to quantify the contribution of each module to the overall performance, thereby fully demonstrating the innovation and necessity of this invention at the experimental level. In summary, this invention provides a unified model and formal expression for key aspects in theory, enabling it to offer high accuracy, high stability, and interpretable identity recognition and verification capabilities in complex ID card imaging scenarios and high-concurrency business environments. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the structure of a high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification according to an embodiment of the present invention. Detailed Implementation
[0020] The present invention will be further illustrated below with reference to the accompanying drawings and specific embodiments. These embodiments are implemented based on the technical solutions of the present invention, and it should be understood that these embodiments are only used to illustrate the present invention and are not intended to limit the scope of the present invention.
[0021] like Figure 1 As shown, this embodiment of the invention provides a high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification, including an adaptive ID card image correction module (MS-SGDC), a text detection and recognition module (PP-OCRv5), a key information extraction module (ID-KIE), a knowledge graph-assisted verification module (KG-Reasoner), and a dynamic load balancing and high-concurrency optimization module (DLB-SH).
[0022] The adaptive ID card image correction module processes the ID card image to form a standardized image. The multi-scale semantic-guided dynamic correction algorithm (MS-SGDC) proposed in this invention can be formally defined as... To standardized ID card images Mapping: ; in, For mapping functions, These are the model parameters to be learned / configured. This mapping consists of sub-modules such as "multi-scale feature pyramid extraction," "image quality assessment and dynamic resolution selection," "ID card detection and localization," and "cascaded perspective and angle correction." The overall goal is to minimize the deviation of the main text direction and the local geometric distortion metric before and after correction, while constraining geometric distortion, illumination changes, and noise interference, thereby providing a unified and stable input for subsequent OCR and KIE modules. Specifically: 1. Multi-scale feature pyramid network architecture The adaptive ID card image correction module adopts a 5-layer feature pyramid network structure. Image features are extracted at five scales, denoted as: ; The backbone network is based on the EfficientNet-B0 architecture, and features at all scales are uniformly projected into a 256-dimensional channel space through lateral convolution. ; Feature fusion employs a bottom-up strategy: for each scale, the semantic features of the previous level are first upsampled to the current scale, and then fused layer by layer with the features of the current scale to obtain candidate fusion features. Subsequently, adaptive weights are constructed using global average pooling (GAP) and a fully connected layer (FC): ; in and The final fusion features are: ; in, The characteristics after fusion Candidate features The weighting coefficients, It is an exponential function. This is a global average pooling operation. The features are those processed by global average pooling. This is for fully connected layer processing. To use lateral convolution processing, For real numbers, Features height, Features width, For the first Features extracted from layered network structures The input image.
[0023] Through the above explicit weighted fusion, this invention unifies "multi-scale details" and "high-level semantics" into a differentiable function form, which is different from the existing FPN structure that uses fixed weights or empirical parameter tuning, so that the subsequent detection and correction modules have a mathematical basis for optimization and reproducible experiments.
[0024] 2. Dynamic resolution adaptive processing A comprehensive quality assessment function is constructed, and resolution mapping is performed based on the quality assessment scores calculated by this function to select the optimal processing resolution. Specifically, the quality assessment function is expressed as follows: ; in, For the input image The quality assessment score, Rate the clarity. The brightness and contrast ratio are rated. For noise level estimation, , , As a preferred embodiment, the weights are... By selecting through a grid search on the validation set, end-to-end recognition accuracy is maximized.
[0025] The resolution mapping method based on the quality assessment score calculated using the quality assessment function is as follows: ; in, This refers to the mapped resolution.
[0026] Unlike existing "fixed input size" or purely empirical division, this invention uses... and This constitutes a well-defined decision-making process that can be reproduced and ablation analyzed on different datasets.
[0027] 3. ID card detection and positioning The location of the center point of an ID card is predicted by heatmap regression. The precise positional offset of the center point is predicted, compensating for the quantization error caused by downsampling. Starting from the detected center point, the relative offset vectors of the four corner points are regressed to form an 8-dimensional regression target. , These represent the horizontal and vertical offsets of the k-th corner point relative to the center point, respectively, where k = 1, 2, 3, 4. Details are as follows: In fusion features A single-stage detection head is constructed above, and the output is: Center point heat map ,in, The height of the heatmap at the center point. Width of the center point heatmap; center point offset ; Corner point offset .
[0028] Center point detection: Gaussian kernel is used to generate heatmaps of training targets. The peak value is set at the center of the ID card. During training, a heatmap of the center point is generated. Focal loss is used. ; in, The loss value for the center point heatmap is the optimization objective for model training. The total number of pixels in the central heatmap. The horizontal coordinates of the center point heatmap The vertical coordinates of the center point heatmap. The true label of the center point heatmap, For the predicted heatmap pixel values, , Adjust the hyperparameters for loss.
[0029] Center point offset regression: This regression addresses the quantization error introduced by downsampling by regressing the offset. ,use loss: ; in, This is the loss value for the center point offset. The number of ID card samples. Predicted center point offset The actual label for the center point offset.
[0030] Corner Regression: Using the center point as a reference, regress the relative offset vectors of the four corner points. ; in, This is the set of predicted offsets from the center point of the ID card to its four corner points. This is the transpose of the matrix.
[0031] Similarly, loss: ; in, The loss value is the offset of the four corner points. The true labels are the sets of offsets from the center point of the ID card to its four corner points. The L1 norm symbol is used. The total detection loss is a weighted sum: ; in, For the overall detection loss, The loss weights are defined in this formal definition, which enables the ID card detection module to have optimizable end-to-end learning capabilities.
[0032] 4. Cascaded perspective transformation correction Based on the four detected corner points, a perspective transformation matrix is calculated, and coarse geometric correction is performed using this matrix. Then, text line detection is performed on the corrected result to extract the geometric information of the text region. The overall tilt angle is obtained by calculating the principal direction angle of the text line. Outliers are removed using median filtering. When the absolute value of the tilt angle exceeds a set threshold (0.5°), precise angle correction is performed using rotation transformation. Details are as follows: 1) Geometric coarse correction: Based on the coordinates of the four corner points obtained from the detection... and the corner points of a standard rectangle The perspective transformation matrix is obtained by solving the homogeneous system of equations. ,satisfy: ; in Let be the scale factor. The perspective transformation matrix can be expressed as: ; in, This is a function in the OpenCV library used to calculate the perspective transformation matrix, which maps the original image to a geometrically standard rectangle.
[0033] Fine-tuning: Text line detection is performed on the coarse-tuned results to obtain... Text line direction vector , The median of the angles between the vectors As a whole tilt estimate: ; in, For median operations, Direction vector The component in the vertical direction, Direction vector For the horizontal component, outliers are removed by using median filtering. At that time, with the image center Construct a rotation matrix for the rotation point:
[0034] Rotate the image to horizontal alignment. The final output standardized ID card image size is [size missing]. The image is displayed in pixels, with an aspect ratio of 1.6:1, in RGB color format, and with a 2–3 pixel margin at the edges. This two-level geometric model is equivalent to performing continuous affine / projective transformations on the image in perspective and rotation spaces, which is theoretically more complete than traditional heuristic-based cropping and rotation schemes.
[0035] The text detection and recognition module is used to detect and recognize ID card text information from the standardized image. Based on the PP-OCRv5_server_det detection model and the PP-OCRv5_server_rec recognition model, the module constructs a dedicated training dataset for ID cards and performs incremental fine-tuning on a general OCR dataset to achieve the detection and recognition of ID card text. The recognition model can be formally denoted as: ; in, For model parameters, Output as a text sequence. The goal of this training is to identify the network. The objective is to minimize the expected loss on ID card scenario data while ensuring that performance does not degrade in general scenarios. ; in, To optimize the minimization of the parameters ϕ of the recognition network, For data distribution The average of the samples is calculated. For a mixed dataset, , For a dedicated training dataset, The weight coefficients are for a dedicated training dataset. For the generated synthetic sample, For sequence recognition loss, For the weight hyperparameters of knowledge distillation, For knowledge rectification loss, (For pre-trained high-precision recognition networks) on input The predicted output, To use a dedicated training dataset Image samples from the middle sample This is due to knowledge distillation loss. The format clearly defines the optimization goal as "maintaining general capabilities + enhancing capabilities in ID card scenarios."
[0036] 1. Construction of a dedicated dataset for ID cards This invention constructs a dedicated training dataset containing 10,000 standardized ID card samples. All samples were standardized images processed by the MS-SGDC module, with a uniform size of 640×400. Data sources included both corrected real samples and standard synthetic samples. Corrected real samples: 6,000 original ID card images were collected and geometrically standardized samples were obtained through the adaptive ID card image correction module. The real distribution of illumination, brightness, contrast, etc. was preserved to ensure the model's adaptability to actual shooting conditions and to statistically cover different regions and ID card versions.
[0037] Illumination and quality distribution constraints: The samples are divided into natural light (35%), indoor light (30%), direct strong light (15%), and low light environment (20%) according to the shooting conditions. The grayscale brightness covers 40–240, the contrast range is 0.3–2.5, and the blur, noise and color temperature changes are controlled within the identifiable range, so as to explicitly model the input distribution.
[0038] Standard synthetic samples: Generate 4000 synthetic samples The size and aspect ratio are consistent with the real sample. By controlling parameters such as brightness, illumination unevenness, and contrast, a family of repeatable illumination transformation operators is formed, providing controllable variables for subsequent ablation experiments.
[0039] 2. Enhanced data generation for rare characters To address the uncommon characters in the address field and the issuing authority field, this invention constructs an uncommon character library. It contains 3856 character samples, including 1247 unique and rare characters and their variants, and generates address / organization samples with rare characters based on administrative division data. Address generation can be formalized from a five-level administrative structure. Sampling in the Cartesian product:
[0040] in, Control the probability of injecting rare characters (approximately 30%). This is a function for combining and formatting elements.
[0041] The issuing authority sample was taken from the public security organ directory, and rare characters were injected with a 20% probability. Each rare character was rendered using a rendering function. Generate 8–12 style variants; the overall sample complexity is approximately , 1 represents the number of single-character variants, which facilitates theoretical analysis and expansion.
[0042] 3. Incremental fine-tuning training strategy A three-stage progressive incremental training approach is adopted to avoid catastrophic forgetting: 1) Stage 1 (low learning rate adaptation): Within 40 epochs, allow the model to smoothly transition from the general distribution to the ID card distribution. 2) Phase Two (Strengthening Uncommon Characters): Train for 30 epochs, and add loss weights to the uncommon character samples. This enables reweighted learning of difficult samples.
[0043] Phase Three (Fine-tuning of the Target Scenario):
[0044] The training was performed for 20 epochs using only ID card data. The total loss was:
[0045] in It only works on samples containing uncommon characters. By explicitly specifying the loss form and training phase, the incremental training strategy of this invention is verifiable and reproducible.
[0046] The key information extraction module is used to parse the key fields of the ID card text information, including: name, gender, ethnicity, date of birth, ID card number, address, issuing authority, validity period, and other eight core fields, along with their confidence level and risk labels. For ease of formal description, the OCR detection and recognition result set is defined as denoted as...
[0047] in, Indicates the first The spatial position (rectangular coordinates) of each text box. For the corresponding text content, The character-level or text box-level confidence score provided for the text detection and recognition module; The field set is denoted as:
[0048] The field extraction results are represented as These represent the field value, field confidence level, and field risk label, respectively. The overall functionality of the key information extraction module can be abstracted as a mapping:
[0049] This mapping consists of the following sub-functions: Multi-level field locator function This is used to assign text boxes to specific fields based on prior knowledge of standard layout positions; adaptive regular expression matching engine. It is used for formatted parsing and preliminary validation of fields such as ID card number, date, address, and name; OCR intelligent error correction mechanism. Error correction is performed through character mapping, edit distance, and contextual semantics; multi-field cross-validation function. Used to verify logical consistency between fields; a structured output and confidence score fusion function. It is used to calculate the confidence level, quality level, and risk label of the field and the whole certificate.
[0050] By combining the above modules, this invention formalizes the originally engineered "location + rule + experience-based error correction" process into a set of definable and derivable functions and a scoring system, providing a foundation for subsequent ablation experiments and theoretical analysis. Specifically: 1. Multi-level field location algorithm 1) Coordinate system establishment and standard template On the standardized ID card image processed by the correction module, with the top left corner as the origin... ,Establish A standard two-dimensional coordinate system for pixels. The ID card area is divided into multiple sub-areas based on function, including the portrait area, name area, gender and ethnicity area, date of birth area, address area, ID number area, issuing authority area, and validity period area. For each key field... Define its standard position rectangular template as: The center point of each rectangle is denoted as .
[0051] 2) Dynamic position matching and fault tolerance For each OCR text box Its rectangular coordinates are centroid coordinates for:
[0052] To characterize the spatial proximity between the text box and each field template, a weighted Euclidean distance is defined. for: ; in, This is a weighting coefficient in the vertical direction, used to reflect the characteristic that ID card layout is more sensitive to field differentiation in the vertical direction. In this embodiment, it is taken as... .
[0053] The field attribution strategy is as follows: For text boxes Calculate its relationship with all fields distance ; Pick smallest field ,like Then the text box will be To which field , The distance threshold is taken as [value] in this embodiment. Pixel.
[0054] Considering minor geometric distortions and positioning deviations in images, this invention sets a position tolerance range: allowed in the horizontal direction. Width offset; vertical direction allowed Height offset. When With field center If the deviation exceeds the standard tolerance range but is still within 1.5 times the tolerance range, the system allows the text to be used as a candidate and then further filtered in subsequent regular expression matching and field consistency verification.
[0055] 3) Complexity Analysis Suppose that there are 100 OCR text boxes in an ID card image. Number of fields If the constant is true, then the time complexity of the field location algorithm is O(n). This meets the real-time requirements of high-concurrency scenarios.
[0056] 2. Adaptive Regular Expression Matching Engine Based on the format characteristics of each field in an ID card, a dedicated regular expression matching rule system was designed to identify fields within a standard location area. Specifically: 1) Name field matching rules The name field typically consists of 2–4 consecutive Chinese characters and supports "·" as a separator for minority names. The regular expression is:
[0057] To be compatible with the scenarios of compound surnames and extremely few special names, the system allows the maximum name length to be extended to 5 characters. When matching, filter out the segments containing numbers, English letters, and punctuation marks, and only retain the candidates that meet the above regular rules.
[0058] For multiple candidate results, the system is based on: the score of the candidate text and the field position ; the deviation between the length of the candidate text and the distribution of common name lengths; comprehensively calculate the regular matching score of the name field .
[0059] 2) ID card number verification algorithm The ID card number field must strictly conform to the 18-bit coding rule. Let the recognition result be , then the verification steps include: Area code verification: is the area code, and its legality is verified by querying the national standard area code table; Date of birth code verification: is the date of birth code YYYYMMDD, which must meet the legal date rule; Sequence code verification: is the sequence code, which must be 3 digits; Check digit verification (ISO 7064:1983 MOD 11-2): Let the first 17 digits be , , corresponding weights: Calculate Calculate , to obtain the index According to the mapping table Take out the corresponding check digit and compare it with .
[0060] If any of the above checks fails, the of the ID card number field will be significantly reduced, for example, set to below 0.3; when all rules are fully passed, take 1.
[0061] 3) Intelligent parsing of date fields Support automatic recognition of multiple date representation formats, including: Standard format: "YYYY year MM month DD day"; Dot-separated format: "YYYY.MM.DD"; Compact format: "YYYYMMDD".
[0062] The comprehensive regular expression can be written as:
[0063] After parsing, perform logical verification on the date: Year range: 1900–2100; Month range: 1–12; The upper limit of the date is determined according to the month and leap year rules: February in a common year days; February in a leap year Day; January, March, May, July, August, October, December Day; April, June, September, November Day. If the format matches but the logical verification fails, the date field Is between 0.3 and 0.6; Take 1 when both are successful.
[0064] 4) Hierarchical matching of address fields To improve the stability of address field parsing, the present invention uses a hierarchical matching strategy from coarse to fine: 1. Provincial-level matching, 2. Prefecture-level matching, 3. County-level matching, 4. Subdistrict and township matching, 5. Detailed address matching. The system establishes a standard geographical name dictionary covering 34 provincial-level, 333 prefecture-level, and 2844 county-level administrative regions, and outputs a hierarchical score for each level of matching, which is finally synthesized into the address field .
[0065] 5) Complexity analysis For each field , for the candidate text Apply the regular expression set item by item , the matching complexity is about . Due to the limited number of fields and scale, it is approximately linear time in the single-document scenario.
[0066] 3. Intelligent error correction mechanism for OCR errors Construct a multi-level error correction system covering label fields, agency names, confusion between numbers and letters, and Chinese characters with similar shapes to correct the recognized fields, specifically as follows: 1) Keyword field error mapping table By statistically analyzing the OCR recognition results of 100,000 ID cards, a high-frequency error mapping table is constructed, such as "address" [["地止","地扯","她址","地坫"], "police station" [["派出听","涯出所","派山所"], , "鉴" "签", etc.
[0067] 2) Three-level error correction algorithm (1) The first level: exact mapping error correction For the OCR output text, search for the error mapping table character by character or substring by substring, and perform one-to-one replacement. The complexity of this stage is \(O(L)\), where \(L\) is the text length. Through statistics, the error correction coverage rate is about 65%, and the accuracy rate is about 98%.
[0068] (2) Second level: Fuzzy matching error correction When the exact mapping fails to correct the error, the system performs Levenshtein editing distance calculation between the text and the standard words in the dictionary. The distance is defined as the minimum number of operations for the three operations of insertion, deletion and replacement.
[0069] When a standard character or word is at an edit distance from the current recognition result When the distance is between two points, each point is considered a candidate, and the one with the smallest distance is selected as the error correction result. The computational complexity of the edit distance is O(n log n). Statistical results show that this level of error correction has a coverage rate of approximately 25% and an accuracy rate of approximately 89%.
[0070] (3) Level 3: Contextual semantic error correction Building upon the first two levels of error correction, the text is treated as an n-gram sequence of characters or words, and the probability of sequence validity is calculated using an N-gram language model. For different error correction candidates, calculate their conditional probability under a given field context (e.g., "Issuing Authority: xx Municipal Public Security Bureau"), and select the one with the highest probability as the final error correction output. This stage achieves approximately 10% coverage and approximately 92% accuracy.
[0071] 3) Complexity and Triggering Strategy Analysis The overall error correction process has a time complexity of approximately [missing information - likely related to time complexity]. However, practicality is ensured through the following strategies: Level 3 error correction is triggered only for key fields (such as label fields, ID numbers, addresses, and issuing authorities); text exceeding the length threshold is first precisely mapped and truncated to reduce the number of edit distance calculations; high-frequency error correction results are stored in a cache, and duplicate address / authority strings can be... Query. With the above optimizations, this error correction mechanism accounts for a very small percentage of the document processing time, meeting high concurrency requirements.
[0072] 4. Multi-field cross-validation algorithm Establish a logical consistency verification mechanism between fields, performing multi-dimensional cross-validation on ID card number, gender, date of birth, address, issuing authority, and validity period to improve overall extraction accuracy. Specifically, define field value vectors: Define constraint set ,include: , , , , .
[0073] For any constraint Define the indicator function: When constraints Satisfaction; Otherwise. Multi-field cross-consistency scoring. Defined as: The rating is in In general, higher numerical values indicate better logical consistency between fields. Below is a detailed explanation of several key constraints: 1) Verification of ID card number consistency Gender consistency check: Gender is determined based on the parity of the 17th digit of the ID number (counting from 1, the 17th digit is the sequence code): odd numbers indicate male, even numbers indicate female. If inconsistent with the gender field, Otherwise, it is 1.
[0074] Birth date consistency check: Extract the birth date code YYYYMMDD from the 7th to 14th digits of the ID card number and compare it with the standardized value of the birth date field. (Allowed) The error range (considering special cases such as lunar calendar / Gregorian calendar conversion or data entry errors) is considered inconsistent if it exceeds the range.
[0075] 2) Geographical location consistency verification Region code verification: The first 6 digits of the ID card number are mapped to an administrative division node, which is matched with the "province-city-district / county" parsed from the address field. If they do not match, the corresponding constraint is 0. Issuing authority verification: The issuing authority's administrative division node is found based on its name and compared with the administrative division node in the address field. The administrative division where the issuing authority is located must be within the administrative region of the address or its superior region; otherwise, it is considered abnormal.
[0076] 3) Time-Logic Consistency Verification Reasonableness of document validity period: Check whether the time span between the issuance date and the validity period complies with the relevant regulations of the Ministry of Public Security: under 16 years old, the validity period is 5 years; 16-25 years old, the validity period is 10 years; 26-45 years old, the validity period is 20 years; 46 years old and above, the validity period is indefinite.
[0077] Age logic check: Calculate the current age based on the date of birth and verify whether the validity period is reasonable. If the validity period of the document has exceeded the due period but has not been renewed, it can be marked as a risk.
[0078] 5. Structured output formatting processing The extracted field results are uniformly converted into standardized structured data, and the field confidence score, the overall certificate joint confidence score, and the field / overall certificate risk label are calculated. The results are then output in JSON format for use by business systems, as detailed below: 1) Data standardization processing Text cleaning: Remove extra spaces, newlines, tabs and other irrelevant characters, and unify the character encoding to UTF-8.
[0079] Format standardization: Date fields are uniformly converted to the ISO 8601 standard format YYYY-MM-DD; Address fields are split according to administrative division levels: provincial, prefecture-level city, district / county, street / township, community / village, and detailed address, and aligned with the national standard administrative division database.
[0080] Data validation: Verify the ID card number by checking the check digits; check the validity of the date; and perform hierarchical integrity verification and knowledge graph alignment pre-check on the address.
[0081] 2) Field confidence fusion model For each field Based on confidence information from multiple sources, including: OCR field confidence level ; Regular expression matching precision Location accuracy (Converted from relative distance), multi-field cross-validation consistency contribution (Depend on (Profit sharing) and character clarity (Obtained from local image quality assessment). Define the field confidence level. for:
[0082] All items are normalized to The weighting coefficients can be obtained by grid search on the validation set, or the above empirical values can be used as the initial configuration to provide adjustable parameters for subsequent experiments.
[0083] 3) Joint Confidence Model of the Whole Evidence To measure the overall reliability of the ID card recognition result, this invention introduces a joint confidence model. The weights of each field are defined. satisfy Among them, core fields such as ID card number, name, and address have higher weights. Define the joint confidence level of the entire ID card. The weighted geometric mean is as follows: ; in, For multiplication operations, this definition has the following characteristics: when the confidence of a key field is extremely low, the joint confidence will decrease significantly, helping the system identify high-risk samples; by adjusting... It can be adapted to the different business requirements regarding the importance of each field.
[0084] Field risk labeling system: To enhance project usability, this invention explicitly adds field risk labels and whole certificate risk labels to the structured output.
[0085] Field quality level: based on The field quality is divided into four levels: Level A ( Grade B Grade C Grade D Grade A fields are high-quality and can be used directly; Grade B fields are good and manual sampling is recommended or determined according to business strategy; Grade C fields are of medium quality and manual review is recommended; Grade D fields are of low quality and must be manually confirmed or re-sampled.
[0086] Field risk label The following signals are given: 1) The field format is seriously incorrect (such as the ID number verification fails); 2) The field fails to match the knowledge graph or has low similarity; 3) The field violates the logical constraints multiple times in multi-field cross-validation; 4) The field conflicts with historical records or business rules (optional). And write it into the structured output.
[0087] Risk label for the whole certificate : combination Each field The results are combined with the knowledge graph verification results for judgment: when Threshold 1, or the presence of key information fields. At that time, the whole certificate When multiple medium-risk fields exist or knowledge graph verification fails multiple times, it can be set to MEDIUM; otherwise, it should be determined as LOW or NONE based on business strategy. This risk labeling system provides a unified interface for subsequent risk control engines and manual review.
[0088] The knowledge graph-assisted verification module constructs a knowledge graph covering four levels of administrative divisions across the country. It then performs rapid node lookup, multi-level link similarity verification, and logical validation on the address fields and related information output by the text detection and recognition module and the key information extraction module. Given the address hierarchy parsing results output by the key information extraction module: in These are string representations for provincial, prefecture-level city, district / county level, and street / township level, respectively.
[0089] A knowledge graph is defined as a directed tree graph: ; A set of administrative division entity nodes; For each edge, there is a set of "belonging to" relationships. This indicates that a lower-level node belongs to a higher-level node.
[0090] The goal of the knowledge graph-assisted verification module is to: determine Is it possible to draw a diagram? A legal path was found. If a path is missing or a node does not exist, the highest-scoring candidate path is found through multi-level similarity matching and uncommon character correction. The corrected address field and verification result are output, and the result is fed back to the key information extraction module to adjust the field confidence and risk label. Formally, this can be represented as... Find the optimal path above: ; in, This represents the set of all legal province-city-district / county-street links, with Score being a comprehensive similarity scoring function. Details are as follows: 1. Construction of a knowledge graph of four levels of administrative divisions The knowledge graph constructed in this invention covers four levels of administrative divisions across the country and includes the following nodes and relationship scales: There are 34 provincial-level nodes, 333 municipal-level nodes, 2,844 district / county-level nodes, and 44,075 street-level nodes, totaling [number of physical nodes]. Hierarchical relationship The hierarchical relationship uses a single "membership" relationship, forming a strict tree-like hierarchical structure: each non-root node has one and only one parent node. ; can be done multiple times The call traces back from any node to the provincial or virtual root node; the tree height is approximately 4, and the path length is finite. Each node contains the following core attributes: standard name (name), administrative division code (code), parent (parent), and a list of children (children).
[0091] 2. Fast Algorithm for Graph Node Search 1) Multi-level hash index structure To achieve millisecond-level node existence determination, this invention establishes hash index tables for each of the four levels of administrative divisions: Provincial-level node HashMap<String,Node> ; City-level node HashMap<String,Node> ; District / county level node HashMap<String,Node> ; Street-level node HashMap<String,Node> .
[0092] A string hash function is used to calculate key values, and a multi-key mapping is established for node names and common aliases, thereby supporting... Search with expected time complexity.
[0093] 2) Address resolution and lookup process Given address resolution result The search process is as follows: Province-level search: Search for the corresponding node ; if the search fails, trigger province-level similarity matching (see below); ; if the search fails, trigger province-level similarity matching (see below); City-level search: Search for the corresponding node and verify ; if the search fails, trigger city-level similarity matching; ; if the search fails, trigger city-level similarity matching; District / county-level search: Search for the corresponding node and verify ; ; Street-level search: Search for the corresponding node and verify ; .
[0094] If the search for any of the above-level nodes fails, the similarity verification and rare character error correction mechanism can be triggered.
[0095] 3) Quick failure and statistical performance To reduce ineffective calculations, the present invention adopts a quick failure mechanism: when the province-level search fails, immediately trigger province-level similarity matching, without continuing to search for city, district / county, and street nodes downward, reducing the average calculation overhead.
[0096] In actual operation, the success rate statistics of node search are as follows: Province-level: 99.2%; City-level: 97.8%; District / county-level: 94.3%; Street-level: 89.7%. Under the combination of hash search + quantity similarity calculation, the average time-consuming for single-address verification is significantly lower than 1 ms.
[0097] 3. Multi-level link similarity verification algorithm When the search for a certain-level node fails or there is a fuzzy matching requirement, the present invention triggers multi-level link similarity verification based on edit distance and enhanced rare characters.
[0098] 1) String similarity calculation Let the OCR result string be , and the standard string in the knowledge graph be , define the weighted edit distance : The costs of insertion, deletion, and replacement operations are defaulted to 1; for the replacement operation of similar-shaped characters (such as "豪" → "亳"), the cost is set to 0.3.
[0099] The similarity is defined as:
[0100] where To calculate the similarity between character and character , with a value range of [0, 1]. The closer to 1, the more similar. is the character length of the string, is the maximum value function.
[0101] 2) Hierarchical similarity and link consistency Calculate separately for the three levels of province, city, district and county: : Similarity of provincial names; : Similarity of city names; : Similarity of district and county names.
[0102] Comprehensive similarity is defined as:
[0103] At the same time, it is required that there is a strict tree-like subordination relationship between nodes, that is must form a legal path in the graph.
[0104] The final error correction decision is: among all candidate paths, find the path that makes the largest and satisfies , is the threshold, which is taken as in this embodiment.
[0105] 3) Example illustration For example, for the address "Guoyang County, Haozhou City, Anhui Province", after calculation by the knowledge graph-assisted verification module, it is found that: the similarity between "Haozhou City" and "Bozhou City" in the graph is relatively high (the cost of replacing similar-looking characters is low, ); the subordination relationship between "Guoyang County" and "Bozhou City" holds in the graph; compared with other combinations of provinces and cities, the of this path is the largest and exceeds the threshold . Therefore, the system makes an error correction: "Haozhou City" → "Bozhou City", and gives the error correction confidence and risk label.
[0106] 4. Intelligent error correction mechanism for rare place names For place names containing rare characters, the present invention designs a special error correction process.
[0107] Recognition and enhancement of rare characters Construct a rare character dictionary C_rare, which contains 1,247 unique rare characters such as 'Bo, Qiong, Lu, Yan, Zhuo, Li, Juan, Shen, Jun, Pu', etc. Each character generates multiple style variants through a rendering function, with a total of about 3,856 character samples. When the parsed place name contains When any of the characters appears: The system automatically increases the error correction sensitivity. In the edit distance calculation, a lower cost is assigned to the replacement operations related to rare characters, and the rare character consistency weight is increased in the candidate path scoring.
[0108] 2) Error correction by mapping similar-shaped characters Construct 500 groups of mapping relationships for high-frequency similar-shaped characters. Typical examples are as follows: "亳" "豪": Bozhou City Haozhou City; "邛" "穷": Qionglai City Qionglaicity; "甪" "用": Luzhi Town Yongzhi Town; "郾" "偃": Yancheng District Yancheng District.
[0109] 3) Enhancement of subordinate verification When the upper-level place name contains rare characters, the system automatically verifies the lower-level place names. For example: "Haozhou City Woyang County": If there is only a legal path of "Bozhou City Woyang County" in the knowledge graph, then when considering both and at the same time, the candidate score of "Bozhou City Woyang County" will be significantly higher than other combinations; through the consistency support of the lower-level nodes, it is possible to more confidently correct "豪" to "亳".
[0110] 5. Verification trigger and result processing 1) Precise trigger strategy To avoid unnecessary computational overhead, the knowledge graph-assisted verification module adopts a precise trigger strategy and only performs knowledge graph verification when one of the following conditions is met: any level node lookup fails in the address field parsing result; the address field parsing result contains characters in rare characters; an exception occurs in the logical verification of the expiration date or related fields. In normal and simple scenarios, the system can directly pass the results of the key information extraction module without calling the graph verification, thus saving computational resources.
[0111] 2) Result fusion mechanism After the knowledge graph verification is completed, the system calculates the comprehensive similarity and confidence of the error correction candidates and fuses the results according to the following rules: When the comprehensive similarity and the link logic is completely consistent: Automatically replace the original OCR / KIE output with the error-corrected address result; increase the confidence of the corresponding field ; lower the field by one level (e.g., from MEDIUM to LOW).
[0112] When the comprehensive similarity is within In between: Write the error correction result as an alternative candidate into the extended field; Will Marked as MEDIUM; it is recommended that the business side proceed with the manual review process.
[0113] When the overall similarity is below 0.7: retain the text detection and recognition module and the key information extraction module, and the original results; Marked as HIGH.
[0114] 3) Exception handling and dynamic updates For addresses for which no reasonable matching path can be found in the knowledge graph: the system does not perform automatic error correction, but significantly reduces the address field's performance. The sample was marked as high-risk and can be used as candidate data for subsequent knowledge graph updates and supplementation of obscure place names.
[0115] The knowledge graph supports dynamic updates: it periodically mines uncollected place names and their uncommon character forms from newly collected data; and updates the node set. Relation sets A mapping table of similar-looking characters; version management ensures the consistency and traceability of verification results across different versions of the model.
[0116] The dynamic load balancing and high-concurrency optimization module is used to achieve high-concurrency, low-latency processing. Based on the NVIDIA Triton inference server and the Kubernetes (K8s) container cloud platform, this module utilizes technologies such as dynamic batch processing, instance pool management, circuit breaking mechanisms, and automatic scaling to achieve high-concurrency, low-latency ID card recognition services. Theoretically, this invention abstracts the inference service into a service network composed of multiple queuing nodes, and performs formal analysis on concurrency performance, latency distribution, and stability.
[0117] To simplify the description, a single-model inference cluster can be approximated as... Queuing system: The request arrival process follows a Poisson flow, with an average arrival rate of (QPS); Each Pod instance is a service node, and the average service rate is... Cluster parallel service count Utilization rate .
[0118] The necessary condition for system stability is The various dynamic scheduling and scaling strategies of this invention are essentially constraining... Less than the target threshold Optimize expected response time under the premise of And higher quantile delay (P90 / P99). Details are as follows: 1. Dynamic batch processing algorithm Using Triton's built-in dynamic batch processing feature, based on the request queue length Adaptive batch size adjustment A dynamic balance is achieved between low latency and high throughput.
[0119] 1) Batch processing parameter dynamic adjustment strategy Define a function to map queue length ranges to batch sizes. :when Time: Batch size It tends to reduce latency; when Time: Batch size It balances latency and throughput; when Time: Batch size Prioritize increasing throughput. Maximum latency. Set to 5ms, the waiting time for a single request in the batch queue at any given time shall not exceed [a certain value]. This effectively limits queuing time. This avoids additional latency caused by waiting for batch processing in low-concurrency scenarios.
[0120] The batch processing timeout mechanism guarantees that when the queue length is insufficient to form a set batch size, the waiting time will be reached. This triggers inference for the current batch, ensuring that the end-to-end latency does not exceed business requirements.
[0121] 2) Theoretical basis In dynamic batch processing, the effective service rate With batch size There is an approximate relationship between them. for: ,in, This represents the fixed overhead for each batch (such as frame scheduling, I / O, etc.). To account for the additional computation time that increases slowly with batch size, this invention chooses to use offline load testing. smallest Map and solidify it into It provides an interpretable basis for parameter configuration.
[0122] 2. Kubernetes Container Cloud Platform Instance Management This invention deploys multiple service instances such as image correction, OCR detection, OCR recognition, information extraction, and knowledge graph verification on the K8s container cloud platform, and performs unified load balancing through Service and Ingress.
[0123] 1) Instance pool configuration Image correction model: 100 Pod instances; OCR detection model: 100 Pod instances; OCR recognition model: 100 Pod instances; The information extraction model and knowledge graph verification module are deployed on CPU instances, dynamically adjusting the number of replicas based on CPU utilization and request volume. Load balancing uses a round-robin algorithm to evenly distribute requests across instances. Kubernetes checks Pod status every 30 seconds using livenessProbe and readinessProbe: upon detecting anomalies, it automatically removes faulty Pods from the load pool and triggers a restart for recovery.
[0124] 2) Theoretical Analysis From a queuing theory perspective, increasing the number of Pods $$k$$ is equivalent to increasing the number of parallel service nodes, which can reduce the utilization of a single node. This reduces queuing time and high-resolution latency. By increasing target utilization... Setting it in the range of 0.6–0.8 allows for a trade-off between throughput and latency, while ensuring the system has buffering capabilities during load fluctuations.
[0125] 3. Circuit breaking and fault self-healing mechanism Configure circuit breaker triggering conditions and fault recovery strategies to implement a three-state circuit breaker mode, preventing cascading failures from impacting system stability. Model each critical service endpoint as a finite state machine. C (CLOSED): Normal state, all requests are forwarded normally; O (OPEN): Circuit breaker state, requests are no longer forwarded to this instance or service; H (HALF_OPEN): Half-open state, only a small number of probe requests are sent to the service.
[0126] State transition rules Error rate within the sliding time window and P95 response time Decide: 1.C O-transfer: When the error rate (Statistical window 60 seconds), or when the response time P95 > 500ms, the circuit breaker is triggered and the system enters the OPEN state for 30 seconds.
[0127] 2.O H transition: After the OPEN state lasts for 30 seconds, it enters the HALF_OPEN state and sends a fixed number (e.g., 5) probe requests to the service instance.
[0128] 3.H C or H O-transfer: If all probe requests are successful and the response time returns to normal, the system returns from H to C; otherwise, it re-enters the O state and appropriately extends the circuit breaker time to 60 seconds. After a faulty instance experiences circuit breaker failure, traffic automatically switches to the backup instance, with a switching time of less than 3 seconds.
[0129] 4. Knowledge Graph High Concurrency Optimization To address the high-frequency query requirements for address and expiration date verification, memory optimization and caching strategies are designed to improve concurrent query capabilities.
[0130] 1) Memory graph structure and query performance The knowledge graph will contain 47,286 nodes. The entire system is loaded into memory, using a hybrid storage structure of "hash index + adjacency list": the hash index is used to map node names to node objects. Fast mapping; adjacency lists are used to store hierarchical relationships and lists of subordinate nodes, supporting... Child node traversal with average complexity. Under this structure, the average time for a single address link lookup and verification is <0.8ms, and a single instance can theoretically support an upper limit of approximately 50,000 QPS.
[0131] 2) LRU caching mechanism To further reduce average latency, this invention adds an LRU cache layer before the knowledge graph: a 50MB cache capacity for caching hot query results (such as high-frequency addresses and popular regions); a cache hit rate of approximately 83%; and a response time of <0.1ms upon a hit. Comprehensive analysis shows that the average query time... Approximately:
[0132] By horizontally scaling multiple knowledge graph query instances, the system can easily support online verification requirements of 10,000+ QPS.
[0133] 3) Batch processing optimization In high-concurrency scenarios, 8–16 address or expiration verification tasks from the same batch of inference requests are packaged together for processing: sharing some intermediate calculation results (such as hash table access); reducing lock contention and thread switching overhead. In actual tests, the average processing time can be reduced from 6ms to 2ms, significantly improving throughput.
[0134] 5. Request Priority Scheduling To ensure stable service quality for core services under high load scenarios, this invention designs a four-level request priority queue: P0: VIP services, latency <50ms; P1: Real-time services, latency <100ms; P2: Batch services, latency <200ms; P3: Offline services, latency <500ms.
[0135] 1) Queues and Resource Allocation Reserve 30% of computing resources for P0 / P1 requests and configure dedicated instance pools on both the Triton and K8s sides; The capacities of the four queue levels are set to 100 / 500 / 1000 / 2000 respectively; When a queue exceeds its capacity, the system will either downgrade (e.g., P2→P3) or discard low-priority requests according to the business strategy.
[0136] 2) Scheduling Algorithm A weighted round-robin or priority-based queue scheduling algorithm is adopted: higher priority queues have higher service weights; within a long window, it is guaranteed that P0 / P1 requests occupy at least 30% of the service time slice and resource quota, thereby meeting their strict latency requirements. This priority scheduling strategy can be formalized as follows:
[0137] in, For fields The effective arrival rate of the corresponding business flow The instance service rate that serves this field. The target utilization rate is the upper limit.
[0138] 6. Automatic scaling mechanism based on Kubernetes This invention utilizes Kubernetes HPA (Horizontal Pod Autoscaler) to achieve load-based automatic scaling. By monitoring metrics such as CPU utilization, memory utilization, request queue length, and Pod response time for each service, the number of Pod replicas is dynamically adjusted while ensuring service quality.
[0139] 1) Monitoring indicators and triggering conditions Typical threshold configurations are as follows: CPU utilization: exceeding 70% for a period of time triggers expansion; falling below 30% for a period of time triggers reduction. Memory utilization: Exceeding 80% triggers a capacity expansion alarm; Request queue length: greater than 100 triggers expansion; less than 20 and consistently stable should be considered for shrinking. Pod response time: P95 > 200ms triggers scaling up; P95 < 50ms and low load allows for scaling down.
[0140] 2) Scaling up and down strategies Scaling up: When the scaling conditions are met, Kubernetes automatically creates new Pod instances based on HPA settings, with a scaling time of approximately 60–120 seconds; Scaling down: Set a 300-second delay before scaling down to confirm that the load has indeed decreased and avoid frequent fluctuations; maintain the minimum number of replicas to ensure that the service is always available; The rolling update mechanism of Kubernetes Deployments allows for updating model versions or parameter configurations without stopping services, reducing the impact on online business.
[0141] 7. System monitoring and dynamic adjustment Establish a real-time monitoring system based on native Kubernetes monitoring, supporting dynamic parameter adjustment and automatic anomaly handling. Details are as follows: 1) Key monitoring indicators The following metrics were collected using Prometheus: QPS, request success rate, error rate; response time and P90 / P99 latency for each model stage (correction, detection, recognition, KIE, knowledge graph); Pod CPU, memory, and bandwidth utilization; queue length and batch size distribution; cache hit rate (e.g., knowledge graph cache, OCR result cache); and the number and time ratio of circuit breaker state transitions.
[0142] The monitoring period is 10 seconds, and the abnormal alarm thresholds include: P99 response time > 200ms; error rate > 3%; Pod resource utilization > 90%; abnormally high circuit breaker frequency, etc.
[0143] 2) Dynamic adjustment mechanism When monitoring data triggers an alarm, the system can dynamically adjust parameters in the following ways: By modifying the ConfigMap hot update batch parameters (such as...) The system adjusts various parameters, including ranges within each service interval, load balancing configuration, target utilization and scaling thresholds for HPA, request priority queue capacity and weights, and cache size and expiration policies based on knowledge graph access load. Parameter changes are distributed to each service instance via the Kubernetes API, typically taking effect within 30 seconds, and are updated continuously to ensure uninterrupted service during the update process.
[0144] The above description is merely a preferred embodiment of the present invention. It should be noted that for those skilled in the art, other parts not specifically described are existing technology or common knowledge. Several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification, characterized in that: include: An adaptive ID card image correction module is used to process ID card images to form standardized images; A text detection and recognition module is used to detect and recognize ID card text information from the standardized image; The key information extraction module is used to parse the key fields of the ID card from the text information of the ID card; The knowledge graph-assisted verification module constructs a knowledge graph covering four levels of administrative divisions across the country, and performs fast node lookup, multi-level link similarity verification, and logical verification on the address field and related information in the key fields, thereby realizing error correction and verification of the address in the key fields. The dynamic load balancing and high-concurrency optimization module is used to achieve high-concurrency, low-latency processing.
2. The high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification according to claim 1, characterized in that, The adaptive ID card image correction module processes ID card images in the following ways: A multi-layer feature pyramid network structure is adopted to extract image features at multiple scales. The features at each scale are unified into a 256-dimensional feature representation through horizontal convolution, and then feature fusion is performed. A comprehensive quality assessment function is constructed, and resolution mapping is performed based on the quality assessment score calculated by the quality assessment function to select the optimal processing resolution; The location of the center point of an ID card is predicted by heatmap regression. The precise positional offset of the center point is predicted, compensating for the quantization error caused by downsampling. Starting from the detected center point, the relative offset vectors of the four corner points are regressed to form an 8-dimensional regression target. , These are the horizontal and vertical offsets of the k-th corner point relative to the center point, respectively, where k = 1, 2, 3, 4; The perspective transformation matrix is calculated based on the four detected corner points, and coarse geometric correction is performed using the perspective transformation matrix. Then, text line detection is performed on the result after coarse geometric correction to extract the geometric information of the text region. The overall tilt angle is obtained by calculating the main direction angle of the text line. Outliers are removed by median filtering. When the absolute value of the tilt angle exceeds the set angle threshold, precise angle correction is performed by rotation transformation.
3. The high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification according to claim 2, characterized in that, The feature fusion method is as follows: ; ; ; ; ; in, The characteristics after fusion Candidate features The weighting coefficients, It is an exponential function. This is a global average pooling operation. The features are those processed by global average pooling. This is for fully connected layer processing. To use lateral convolution processing, For real numbers, Features height, Features width, For the first Features extracted from layered network structures The input image.
4. The high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification according to claim 2, characterized in that, The quality assessment function is expressed as follows: ; in, For the input image The quality assessment score, Rate the clarity. The brightness and contrast ratio are rated. For noise level estimation, , , These are the weighting coefficients; The resolution mapping method based on the quality assessment score calculated using the quality assessment function is as follows: ; in, This refers to the mapped resolution.
5. The high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification according to claim 2, characterized in that, The perspective transformation matrix is calculated as follows: ; in, The calculated perspective transformation matrix, This is a function in the OpenCV library used to calculate the perspective transformation matrix. To obtain the coordinates of the four corner points, These are the coordinates of the corner points of a standard rectangle.
6. The high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification according to claim 1, characterized in that, The text detection and recognition module is based on the PP-OCRv5_server_det detection model and the PP-OCRv5_server_rec recognition model. It achieves the detection and recognition of ID card text by constructing a special training dataset for ID cards and making incremental fine-tuning on the basis of a general OCR dataset.
7. The high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification according to claim 1, characterized in that, The key information extraction module extracts the key fields of the ID card from the ID card text information in the following way: Establish a field position mapping system based on the standard layout of the ID card to determine the standard position area corresponding to each field; Based on the format characteristics of each field of the ID card, a dedicated regular expression matching rule system was designed to identify fields within the standard location area; Construct a multi-level error correction system covering label fields, organization names, confusion between numbers and letters, and similar-looking Chinese characters to correct errors in the identified fields; Establish a logical consistency verification mechanism between fields and improve the overall extraction accuracy through multi-dimensional cross-validation; The extracted field results are uniformly converted into standardized structured data, and the field confidence score, the overall certificate joint confidence score, and the field / overall certificate risk label are calculated. The data is then output in JSON format for use by business systems.
8. The high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification according to claim 1, characterized in that, The knowledge graph-assisted verification module performs error correction and verification on the addresses in the key fields in the following manner: Construct a four-level administrative division knowledge graph of province, city, district / county, and street; Design a fast node lookup mechanism based on hash indexes to achieve millisecond-level node existence determination; When a graph node search fails, a similarity verification mechanism based on multi-level links is triggered to verify the logical consistency of multi-level addresses through the membership relationship of the knowledge graph. When a superior place name contains uncommon characters, the system automatically checks the matching of the subordinate place name as an auxiliary verification. When a graph node search fails or the validity period logic is abnormal, a verification is triggered. The address or validity period that passes the verification is automatically replaced with the original recognition result. For addresses that cannot match any graph node or for abnormal validity periods, the system retains the original recognition result but lowers the overall confidence score. The knowledge graph is continuously optimized by adding new data and updating the mapping of rare characters and validity period rules.
9. The high-concurrency, low-latency ID card parsing system based on knowledge graph-optimized verification according to claim 1, characterized in that, The dynamic load balancing and high-concurrency optimization module achieves high-concurrency, low-latency processing in the following specific ways: Triton's built-in dynamic batch processing function adaptively adjusts the batch size according to the request queue length, dynamically balancing low latency and high throughput. Dynamic management and load balancing of multiple model instances based on the Kubernetes container cloud platform; Set the fuse triggering conditions and fault recovery strategies to achieve a three-state fuse mode and prevent cascading faults from affecting system stability; To address the high-frequency query requirements for address and validity period verification, memory optimization and caching strategies were designed. A four-level priority queue is set up to ensure the quality of core business services; Implement load-based automatic scaling using Kubernetes HPA; Establish a real-time monitoring system based on native K8s monitoring, supporting dynamic parameter adjustment and automatic anomaly handling.