An OCR parameter self-adaptive optimization method and system based on semantic consistency feedback
Patent Information
- Application Number
- CN202611174642.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-04
- Publication Date
- 2026-10-20
AI Technical Summary
例如:现有OCR技术大多采用固定参数或人工经验调节方式,缺乏根据图像特征动态生成参数的能力,复杂情况下容易出现字符缺失、字符粘连及结构识别错误等问题,难以适配复杂图像场景;现有OCR优化方式主要基于字符识别置信度进行结果筛选,缺乏对文本语义合理性、上下文一致性及结构完整性的的综合判断;现有OCR流程通常为单次识别或固定参数多轮识别,缺乏基于识别结果质量动态调整OCR参数的反馈优化机制,当复杂场景下出现识别错误时,现有技术难以根据错误类型自动分析并优化OCR参数,导致系统自适应能力与识别稳定性较低
[0017]本申请实施例至少包括以下有益效果:本申请提供一种基于语义一致性反馈的OCR参数自适应优化方法及系统,该方案获取待识别图像并进行预处理,得到预处理图像;通过预处理操作消除原始图像存在的倾斜、噪声、明暗不均等干扰问题,弱化图像无关背景信息、突出文本区域,改善图像质量,为后续图像特征提取、OCR文本识别提供质量稳定、标准化的图像数据源,降低图像缺陷对后续流程识别精度的负面影响。提取预处理图像的图像特征,得到图像特征向量;量化表征图像清晰度、亮度分布、对比度、噪声等级、倾斜角度、文本方向、页面结构等多维图像属性,将非结构化图像信息转化为计算机可计算、可匹配的标准化图像特征向量,实现图像质量客观数字化描述,为后续智能匹配适配OCR参数提供定量依据,摆脱单纯依靠人工经验选择识别参数的模式。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This application relates to the field of optical character recognition technology, and in particular to an adaptive optimization method and system for OCR parameters based on semantic consistency feedback. Background Technology
[0002] OCR (Optical Character Recognition) technology completes the recognition process through preset parameters and is widely used in scenarios such as invoice recognition, document digitization, table parsing, and image text extraction. However, existing OCR solutions have many shortcomings. For example, most existing OCR technologies use fixed parameters or manual experience to adjust them, lacking the ability to dynamically generate parameters based on image features. In complex situations, problems such as missing characters, character merging, and structural recognition errors easily occur, making it difficult to adapt to complex image scenarios. Existing OCR optimization methods mainly rely on character recognition confidence to filter results, lacking a comprehensive judgment on the semantic rationality, contextual consistency, and structural integrity of the text. Existing OCR workflows are usually single recognition or multi-round recognition with fixed parameters, lacking a feedback optimization mechanism to dynamically adjust OCR parameters based on the quality of recognition results. When recognition errors occur in complex scenarios, existing technologies cannot automatically analyze and optimize OCR parameters according to the error type, resulting in low system adaptability and recognition stability.
[0003] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the Invention
[0004] The main objective of this application is to propose an OCR parameter adaptive optimization method and system based on semantic consistency feedback, which aims to improve the accuracy, stability and parameter adaptive capability of OCR recognition in complex image scenarios.
[0005] To achieve the above objectives, this application provides an OCR parameter adaptive optimization method based on semantic consistency feedback, the OCR parameter adaptive optimization method comprising: The image to be identified is acquired and preprocessed to obtain a preprocessed image; Extract the image features from the preprocessed image to obtain the image feature vector; Establish a correspondence between image feature vectors and OCR parameters, and generate multiple sets of valid OCR parameter configurations based on the correspondence and the current image feature vectors; Based on multiple sets of valid OCR parameter configurations, a corresponding OCR recognition strategy is constructed. Based on the OCR recognition strategy, the current image to be recognized is recognized to obtain multiple sets of candidate recognition results. Semantic consistency evaluation is performed on multiple groups of candidate recognition results to obtain semantic scores. The results are then ranked based on the semantic scores, and the optimal recognition result is output. The semantic consistency evaluation includes text semantic rationality evaluation, contextual consistency evaluation, text structural integrity evaluation, and field matching integrity evaluation. Error analysis and verification are performed on the candidate recognition results, feedback is provided to optimize the OCR parameter configuration, and the final valid recognition result is output.
[0006] In some embodiments, the image features include image sharpness, image brightness distribution, image contrast, image noise level, image tilt angle, text direction features, and page structure features.
[0007] In some embodiments, a correspondence is established between image features and OCR parameters, and multiple sets of valid OCR parameter configurations are generated based on the correspondence and the current image feature vector, including: Based on the image feature vectors of historical images to be identified and the corresponding optimal OCR parameters, a mapping relationship library between the image feature vectors and OCR parameters is constructed. Using the current image feature vector of the image to be processed as input, the baseline parameter configuration is obtained by retrieving the mapping relationship library based on similarity matching; Based on the benchmark parameters, parameter perturbation sampling is performed to generate multiple sets of candidate OCR parameter configurations; Boundary validation is performed on the candidate OCR parameter configurations, and multiple sets of valid OCR parameter configurations are output.
[0008] In some embodiments, the OCR parameters are configured in one or more combinations of manually preset parameters, rule-based parameter configuration, experience-based parameter configuration based on historical recognition results, and parameter switching based on image quality; the OCR parameters include binarization threshold, image scaling ratio, denoising parameters, image enhancement parameters, text detection threshold, text direction parameters, character segmentation parameters, and recognition confidence threshold.
[0009] In some embodiments, a corresponding OCR recognition strategy is constructed based on multiple sets of valid OCR parameter configurations. The current image to be recognized is then recognized based on the OCR recognition strategy to obtain multiple sets of candidate recognition results, including: Based on multiple sets of valid OCR parameter configurations, a corresponding OCR recognition strategy is constructed to obtain a set of recognition strategies. Based on the set of recognition strategies, perform image preprocessing operations on the current image to be recognized to obtain a preprocessed image set; Using the preprocessed image set as input, text detection is performed based on the text recognition model to obtain the text detection results; The text region is cropped based on the text detection results, and the text region is input into the character recognition model for character recognition to obtain the character recognition results. Based on the text detection results and character recognition results, the layout structure is analyzed to obtain multiple sets of candidate recognition results.
[0010] In some embodiments, error analysis and verification are performed on the candidate recognition results, feedback is provided to optimize the OCR parameter configuration, and the final valid recognition result is output, including: Determine whether the semantic score of the candidate recognition result meets the preset conditions; If the preset conditions are not met, the OCR parameters are dynamically optimized based on the deviation between the candidate recognition result and the optimal recognition result to generate an optimized parameter configuration. If the preset conditions are met, the candidate recognition results are verified, and the candidate recognition results that pass the verification are output as the final valid recognition results.
[0011] In some embodiments, the OCR parameters are dynamically optimized based on the deviation between the candidate recognition result and the optimal recognition result to generate an optimized parameter configuration, including: The candidate recognition results are compared with the optimal recognition results, and the corresponding error types are analyzed based on differences in character content, text structure, and spatial position. The error types include missing characters, character concatenation, character breakage, text direction errors, and line structure misalignment. Based on the mapping relationship between the error type and the OCR parameters, the OCR parameters are dynamically optimized and an optimized parameter configuration is generated.
[0012] In some embodiments, the candidate recognition results are verified, and the candidate recognition results that pass the verification are output as the final valid recognition results, including: Extract the character confidence information corresponding to the candidate recognition results; The candidate recognition results are subjected to structured parsing and text feature information is extracted. The text feature information includes text length, field content, field format, and key field information. Based on the character confidence information and text feature information, the candidate recognition results are verified according to the verification strategy; If any verification fails, the current candidate recognition result is intercepted and labeled as low quality, triggering parameter adaptive adjustment or directly initiating a retry mechanism; If all verifications pass, the current candidate recognition result will be output as the final valid recognition result.
[0013] To achieve the above objectives, another aspect of this application proposes an OCR parameter adaptive optimization system based on semantic consistency feedback, the OCR parameter adaptive optimization system comprising: An image preprocessing module is used to acquire an image to be identified and preprocess the image to be identified to obtain a preprocessed image; The image feature extraction module is used to extract image features from the preprocessed image to obtain an image feature vector; The parameter generation module is used to establish the correspondence between image feature vectors and OCR parameters, and generate multiple sets of valid OCR parameter configurations based on the correspondence and the current image feature vector; The multi-strategy recognition module is used to construct a corresponding OCR recognition strategy based on multiple sets of valid OCR parameters, and to recognize the current image to be recognized based on the OCR recognition strategy to obtain multiple sets of candidate recognition results. The semantic consistency evaluation module is used to evaluate the semantic consistency of multiple candidate recognition results to obtain semantic scores, sort them based on the semantic scores, and output the optimal recognition result. The semantic consistency evaluation includes text semantic rationality evaluation, context consistency evaluation, text structure integrity evaluation, and field matching integrity evaluation. The parameter feedback optimization module is used to perform error analysis and verification on the optimal recognition result, optimize the OCR parameter configuration, and output the final effective recognition result.
[0014] To achieve the above objectives, another aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method.
[0015] To achieve the above objectives, another aspect of the embodiments of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.
[0016] To achieve the above objectives, another aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0017] The embodiments of this application include at least the following beneficial effects: This application provides an OCR parameter adaptive optimization method and system based on semantic consistency feedback. This scheme acquires the image to be recognized and preprocesses it to obtain a preprocessed image. Preprocessing eliminates interference problems such as tilt, noise, and uneven brightness in the original image, weakens irrelevant background information, highlights text areas, and improves image quality. This provides a stable and standardized image data source for subsequent image feature extraction and OCR text recognition, reducing the negative impact of image defects on the recognition accuracy of subsequent processes. Image features of the preprocessed image are extracted to obtain image feature vectors. These vectors quantify and characterize multi-dimensional image attributes such as image sharpness, brightness distribution, contrast, noise level, tilt angle, text direction, and page structure, transforming unstructured image information into a computer-calcifiable and matchable standardized image feature vector. This achieves an objective digital description of image quality, providing a quantitative basis for subsequent intelligent matching and adaptation of OCR parameters, thus breaking away from the mode of simply relying on manual experience to select recognition parameters.
[0018] A correspondence between image feature vectors and OCR parameters is established, and multiple sets of effective OCR parameter configurations are generated by combining the current image feature vectors. Based on the quality features of the current image itself, basic OCR parameters are adaptively matched, and multiple sets of differentiated candidate parameter schemes are generated through parameter perturbation. Instead of using a single fixed parameter for recognition, multiple adaptation schemes are generated for the same image, covering the optimal parameter possibilities under different image defect scenarios. Based on the multiple sets of effective OCR parameter configurations, corresponding OCR recognition strategies are constructed to recognize the current image to be recognized, obtaining multiple sets of candidate recognition results. Multiple independent OCR recognition strategies are used in parallel to perform text detection and character recognition. Multiple versions of candidate recognition text with different versions are generated for the same input image, fully leveraging the recognition advantages of different parameter configurations. Content that is missed or misrecognized by a single parameter can be corrected under other parameter strategies, enriching the candidate result space and increasing the probability of obtaining high-quality recognized text.
[0019] Semantic consistency is evaluated on multiple candidate recognition results to obtain semantic scores. Based on these scores, the optimal recognition result is output. This approach overcomes the limitations of traditional OCR, which relies solely on image-level confidence scores for result selection. It comprehensively evaluates the rationality of the recognized text from multiple dimensions, including natural language semantics, text structure, and document fields. Semantic information is used to filter the optimal candidate text based on logical coherence, structural integrity, and high field matching, effectively filtering results with high character confidence but semantic incoherence or containing typos and garbled characters, significantly improving the usability of the output text. Error analysis and verification are performed on candidate recognition results, providing feedback to optimize OCR parameter configuration and outputting the final effective recognition result. Based on the optimal recognition result, error tracing is conducted, analyzing the defects in the OCR parameters matched with the current image features, and continuously iterating and updating the mapping relationship between image features and OCR parameters. This forms a closed-loop adaptive optimization mechanism of image recognition—semantic evaluation—parameter feedback, effectively improving OCR recognition accuracy. Attached Figure Description
[0020] Figure 1 This is a schematic diagram illustrating the steps of an OCR parameter adaptive optimization method based on semantic consistency feedback provided in an embodiment of this application; Figure 2 This is a flowchart of an OCR parameter adaptive optimization method based on semantic consistency feedback provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of an OCR parameter adaptive optimization system based on semantic consistency feedback provided in an embodiment of this application; Figure 4 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0022] It is understood that the terms “first,” “second,” etc., used in this application may be used herein to describe various concepts, but unless otherwise stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words “if,” “when,” or “in response to a determination” as used herein may be interpreted as “when…” or “when…” or “in response to a determination.”
[0023] As used in this application, the terms "at least one", "multiple", "each", "any", etc., "at least one" includes one, two or more, "multiple" includes two or more, "each" refers to each of the corresponding multiples, and "any" refers to any one of the multiples.
[0024] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0025] To address the shortcomings of existing OCR solutions, such as static parameter configuration, incompatibility with complex image scenes, lack of comprehensive judgment of recognition results, and inability to achieve dynamic feedback optimization, this application provides an OCR parameter adaptive optimization method and system based on semantic consistency feedback. By analyzing image features, multiple sets of differentiated OCR parameter configurations are automatically generated, and OCR recognition is performed based on these multiple sets of parameters. The semantic rationality, contextual consistency, structural integrity, and field matching integrity of the recognition results are comprehensively evaluated, thereby achieving dynamic adjustment and optimization of OCR parameters to improve the accuracy, stability, and adaptability to complex scenes of OCR recognition.
[0026] This application provides an OCR parameter adaptive optimization method and system based on semantic consistency feedback, relating to the field of optical character recognition. This method and system can be applied to terminals, servers, or software running on either a terminal or server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, or in-vehicle terminal, but is not limited to these. The server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network. The software can be an application implementing the OCR parameter adaptive optimization method and system based on semantic consistency feedback, but is not limited to the above forms.
[0027] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0028] Please see Figure 1 and Figure 2 As shown, Figure 1 This is a schematic diagram of an optional step in an OCR parameter adaptive optimization method based on semantic consistency feedback provided in an embodiment of this application. Figure 1 The method may include, but is not limited to, steps S1 to S6: S1, acquire the image to be recognized and preprocess the image to be recognized to obtain the preprocessed image; The image to be recognized can be a scanned document, photo, screenshot, or image converted from a document, and can be obtained through interface calls, local file reading, or network transmission. After obtaining the image, a simple check is performed on its legality, integrity, and resolution. Legality verifies the file format, such as standard file types like JPEG, PNG, and JPG; integrity refers to image quality, checking for any missing parts. In some implementations, when the image resolution is detected to be below a preset threshold, image scaling can be automatically performed to improve the clarity of text areas. The preset threshold is used to determine whether the image resolution belongs to a low-resolution scene. This threshold is adaptively configured according to different image sources; for example, scanned images and photographed images have different judgment ranges. The specific threshold can be set within the range of approximately 150–600 DPI. Then, preprocessing operations are performed on the image to be recognized. These preprocessing operations include, but are not limited to, grayscale conversion, image denoising, image sharpening, contrast enhancement, tilt correction, binarization, and resolution normalization to improve the clarity and recognizability of text areas in the image. All of the above preprocessing operations can be performed, some can be performed, or the execution order can be automatically selected according to the actual input image requirements. Converting color images to grayscale reduces the time required for subsequent image editing and OCR processing, and makes feature extraction more consistent in the next round of image processing.
[0029] S2, extract the image features of the preprocessed image to obtain the image feature vector; In some embodiments, image features include image sharpness, image brightness distribution, image contrast, image noise level, image tilt angle, text orientation features, and page structure features.
[0030] Specifically, the Laplacian variance algorithm can be used to evaluate the sharpness of the grayscale image converted from the preprocessed image. A grayscale gradient map is obtained through convolution using the Laplacian operator, and the pixel variance of the grayscale gradient map is then calculated. The variance value represents the image sharpness index; a larger variance indicates a more pronounced edge gradient and higher sharpness. The grayscale histogram of the entire grayscale image is statistically analyzed, and the grayscale mean, grayscale median, and pixel proportions of high and low brightness intervals are calculated. These are combined to form brightness distribution feature parameters to characterize the overall brightness distribution of the image. Based on the maximum and minimum grayscale values of the grayscale image, the global contrast is calculated using the Michelson contrast formula. Simultaneously, local windows are divided into regions of the image, and the local contrast mean is calculated. The global and local contrast mean values are then fused to obtain the image contrast feature value. A smooth, text-free background region of the grayscale image is selected, and the standard deviation of the background region's pixel grayscale values is calculated. A higher grayscale standard deviation indicates stronger random noise, thus quantifying the image noise level.
[0031] The Hough transform is used to detect straight lines of text within an image. The tilt angles of multiple text lines are statistically analyzed, and the optimal tilt angle is obtained through angle clustering. If no obvious text lines exist, the tilt angle is output as 0°. By detecting the aspect ratio of connected text regions and the direction of text layout, horizontal and vertical text are distinguished, and text direction identifiers are output as text direction features. Horizontal and vertical projection methods are used to project the image horizontally and vertically to identify the location of text blocks, the number of text regions, and the text-image layout. The distribution of text blocks and the proportion of blank areas on the page are extracted as page structure features.
[0032] All features, including sharpness, brightness distribution, contrast, noise level, tilt angle, text direction, and page structure, are mapped to a unified numerical range for normalization. These features are then stitched together in a preset fixed order to generate a fixed-dimensional image feature vector, which is then output to step S3.
[0033] S3, establish the correspondence between image feature vectors and OCR parameters, and generate multiple sets of valid OCR parameter configurations based on the correspondence and the current image feature vector; In some embodiments, a correspondence between image features and OCR parameters is established, and multiple sets of valid OCR parameter configurations are generated based on the correspondence and the current image feature vector, including: S31, Based on the image feature vectors of historical images to be identified and the corresponding optimal OCR parameters, construct a mapping relationship library between image feature vectors and OCR parameters; A mapping relationship library is pre-established, storing the correspondence between image feature vector intervals and OCR parameter combinations. Specifically, using image feature vectors from a massive historical dataset of images to be recognized as input, the optimal OCR parameter combinations corresponding to different image feature vectors are recorded. Mapping rules are supplemented by manually coded prior rules, storing OCR parameter combinations corresponding to different image feature intervals. For example, images with low clarity and high noise levels are matched with stronger image denoising and image enhancement parameters; images with non-zero tilt angles are matched with corresponding text correction and text direction parameters; and images with uneven brightness are matched with adaptive binarization threshold intervals. The library continuously receives error analysis data from the optimal recognition results fed back in step S6, iteratively updating the mapping relationship library to form a dynamically updatable correspondence between image features and OCR parameters.
[0034] S32, taking the current image feature vector of the image to be processed as input, obtain the baseline parameter configuration based on the similarity matching and retrieval mapping relationship library; Input the current image feature vector output in step S2 into the mapping relationship library. Calculate the distance between the current image feature vector and the feature vectors of each historical sample in the mapping relationship library based on similarity matching, such as Euclidean distance or cosine distance. Select the OCR parameter configuration with the highest similarity to the current image feature vector as the benchmark parameter configuration.
[0035] S33, based on the baseline parameters, performs parameter perturbation sampling to generate multiple sets of candidate OCR parameter configurations; Centered on the baseline parameter configuration, various OCR parameters are subjected to small perturbations and offset sampling within a reasonable value range to generate multiple sets of differentiated candidate parameter combinations. For continuous numerical parameters such as binarization threshold and recognition confidence threshold, a floating range is set above and below the baseline value, and several discrete sampling points are selected. For discrete level parameters such as image scaling ratio, denoising intensity level, and text direction mode, adjacent levels to the baseline level are selected as alternatives. Through the above perturbation strategy, multiple sets of distinct candidate OCR parameter configurations are obtained.
[0036] S34 performs boundary validation on the candidate OCR parameter configurations and outputs multiple sets of valid OCR parameter configurations.
[0037] Boundary verification is performed on all generated candidate OCR parameter configurations, illegal parameter combinations that exceed the range allowed by the algorithm are eliminated, and multiple valid OCR parameter configurations after verification are output and sent to step S4 to perform OCR recognition.
[0038] In addition, in some embodiments, the OCR parameters are configured in one or more combinations of manually preset parameters, rule-based parameter configuration, experience-based parameter configuration based on historical recognition results, and parameter switching based on image quality; the OCR parameters include, but are not limited to, binarization threshold, image scaling ratio, denoising parameters, image enhancement parameters, text detection threshold, text direction parameters, character segmentation parameters, and recognition confidence threshold.
[0039] For example, when using a rule-based parameter configuration method, feature analysis is performed on the image to be recognized to extract image features. Then, corresponding OCR parameters are automatically selected according to preset rules. Text recognition is performed based on the matched OCR parameters, and corresponding recognition results are generated. In some embodiments, the preset rules may be: automatically increasing the image scaling factor when the image resolution is lower than a preset threshold; automatically enabling brightness enhancement parameters when the image brightness is low; automatically increasing the noise reduction processing intensity when the image has high noise; automatically decreasing the text box merging threshold when dense text regions are detected; and automatically enabling table recognition-related parameters when a table structure is detected.
[0040] Furthermore, if the confidence level of the recognition result is lower than a preset threshold, the system switches to another set of OCR parameters for re-recognition, and the result with better recognition performance is used as the final output. Through this method, suitable OCR parameters can be automatically matched according to different image features, thereby improving the accuracy and stability of OCR recognition in complex scenes.
[0041] Compared with existing methods that use fixed or single parameter configurations, this application can dynamically generate multiple sets of OCR parameter configurations according to the actual situation of the image, and obtain different parameter strategies for OCR recognition based on different OCR parameter configurations, thereby improving the adaptability and recognition accuracy of OCR recognition in complex scenarios.
[0042] S4. Construct a corresponding OCR recognition strategy based on multiple sets of valid OCR parameter configurations, and recognize the current image to be recognized based on the OCR recognition strategy to obtain multiple sets of candidate recognition results; In some embodiments, a corresponding OCR recognition strategy is constructed based on multiple sets of valid OCR parameter configurations. The current image to be recognized is then recognized based on the OCR recognition strategy to obtain multiple sets of candidate recognition results, including: S41, construct the corresponding OCR recognition strategy based on multiple sets of valid OCR parameter configurations to obtain the recognition strategy set; Based on each set of valid OCR parameters output in step S3, an independent encapsulation is formed to create a complete OCR recognition strategy. Each OCR recognition strategy is bound to a complete set of parameters, including a unique binarization threshold, image scaling ratio, denoising parameters, text detection threshold, and recognition confidence threshold. All OCR recognition strategies are then aggregated to form a recognition strategy set. The parameters of each OCR recognition strategy are independent of each other, providing an execution scheme for parallel image recognition.
[0043] S42, perform image preprocessing operations on the current image to be recognized based on the recognition strategy set to obtain a preprocessed image set; Iterate through each OCR recognition strategy in the set of recognition strategies, call the full set of image preprocessing parameters bound to the strategy, and perform preprocessing operations such as image scaling, denoising, image enhancement, and binarization correction on the same image to be recognized. Each OCR recognition strategy generates an independent preprocessed image, and all preprocessed images are summarized to form a preprocessed image set.
[0044] S43, using the preprocessed image set as input, performs text detection based on the text recognition model to obtain the text detection result; A single preprocessed image from the preprocessed image set is input into the text recognition model. This model performs image data normalization and dimensionality adaptation through the input layer, and then feeds it into the feature extraction layer for convolutional operations to extract the text visual features from the single preprocessed image. These visual features include unique edge textures, grayscale gradients, stroke outlines, and block grayscale variations specific to the text region within the image, enabling the differentiation between foreground and background interference areas. The feature map output from the feature extraction layer is then fed into the text prediction layer to complete model inference. Through multi-channel classification and coordinate regression operations, it predicts candidate regions containing text in the image, filters out invalid candidate boxes with confidence scores below a preset threshold, and finally outputs the text detection result containing text box coordinates, text direction information, and text region confidence scores.
[0045] S44, based on the text detection results, the text region is cropped, and the text region is input into the character recognition model for character recognition to obtain the character recognition result; Based on the text box coordinates output by S43, independent text region images are cropped from the corresponding preprocessed image. These images, along with text direction information, are then input into the character recognition model. The character recognition model first downsamples and maps the text region images through a feature encoding layer to extract character visual features. These visual features are fine-grained visual representations of stroke shapes, contour edges, grayscale distribution, and local textures corresponding to single characters or consecutive character segments, used to characterize the visual differences between different characters. The feature sequence output by the feature encoding layer is then fed into a sequence modeling layer for context-dependent modeling to complete inference operations, capturing the sequential relationships between characters. Finally, the character output layer performs character classification decoding, outputting the character sequence and the recognition confidence score for each character, thus obtaining the complete character recognition result.
[0046] S45. Based on the text detection results and character recognition results, the layout structure is analyzed to obtain multiple sets of candidate recognition results.
[0047] By fusing text box position and layout information from text detection results with character sequence data from character recognition results, the document's layout, paragraph and field positions, and other page structure are reconstructed, and the text content is organized according to a unified output format. A complete set of text data is generated for each processing link corresponding to each strategy within the recognition strategy set, ultimately yielding multiple sets of candidate recognition results.
[0048] S5 performs semantic consistency evaluation on multiple candidate recognition results to obtain semantic scores, sorts them based on semantic scores, and outputs the optimal recognition result; semantic consistency evaluation includes text semantic rationality evaluation, context consistency evaluation, text structure integrity evaluation, and field matching integrity evaluation. Semantic consistency evaluation across four dimensions is performed independently for each set of candidate recognition results output in step S4. First, a text semantic reasonableness evaluation is conducted. The candidate recognition results are segmented into words, and the segmented results are matched against a pre-built industry thesaurus. The ratio of successfully matched words to the total number of words in the text is calculated to obtain a text semantic reasonableness score. Second, a contextual consistency evaluation is performed. Contextual text information corresponding to the target text in the candidate recognition results is extracted, and a set of contextual keywords is constructed. It is determined whether the current text content contains contextual keywords or related words, and a contextual consistency score is calculated based on the degree of matching. Next, a text structural integrity evaluation is performed. The recognized text is validated based on preset text structure rules, including bracket matching rules, punctuation integrity rules, sentence segmentation rules, and paragraph structure rules. If structural deficiencies, abnormal sentence segmentation, or incomplete punctuation are detected, the text structural integrity score is lowered accordingly. Finally, a field matching integrity evaluation is performed. Preset field templates are loaded for documents with fixed formats such as forms and invoices. Key fields are extracted from the recognition results and matched one by one with the template fields. The field matching integrity score is obtained by using the ratio of the number of successfully matched fields to the preset total number of fields.
[0049] After completing the four sub-evaluations, the text semantic rationality score, context consistency score, text structural integrity score, and field matching integrity score are weighted and summed based on their weights to calculate the total semantic score for each group of candidate recognition results. All candidate recognition results are then sorted from highest to lowest according to the total semantic score, and the candidate recognition result with the highest total semantic score is selected as the optimal recognition result output.
[0050] S6 performs error analysis and verification on the candidate recognition results, provides feedback to optimize the OCR parameter configuration, and outputs the final valid recognition result.
[0051] In some embodiments, error analysis and verification are performed on the candidate recognition results, feedback is provided to optimize the OCR parameter configuration, and the final valid recognition result is output, including: S61, determine whether the semantic score of the candidate recognition result meets the preset conditions; The preset condition is the semantic scoring threshold. The semantic score of the candidate recognition result is compared with the semantic scoring threshold to determine whether the preset condition is met. This semantic scoring threshold is used to determine whether the candidate recognition result reaches a quality level sufficient for subsequent data processing, and is determined based on the statistical results of the semantic score distribution of historical sample data. In some implementations, semantic scoring statistics are performed on the labeled OCR recognition results, and the lowest score of the sample that meets the business usability standard is taken as the semantic scoring threshold, or the quantile value of the score distribution is taken as the semantic scoring threshold. In one specific embodiment, the semantic score range is 0 to 1, and the semantic scoring threshold is set to 0.75. When the semantic score is lower than 0.75, the parameter optimization process is triggered.
[0052] It should be noted that if multiple candidate recognition results all meet the preset conditions in terms of semantic scores, the candidate recognition result with the highest semantic score will be selected as the optimal recognition result, and optimization will be performed based on the OCR parameter configuration corresponding to the candidate recognition result with the highest semantic score. If multiple candidate recognition results have the same semantic score, the candidate recognition result with the higher field matching integrity score will be selected as the optimal recognition result, and optimization will be performed based on the OCR parameter configuration corresponding to the candidate recognition result with the higher field matching integrity score. Here, the field matching integrity score refers to the regular expression or character matching performed between the text recognized by OCR and the fields of the business template. The more and more complete the matching of key fields, the higher the field matching integrity score.
[0053] S62, if the preset conditions are not met, the OCR parameters are dynamically optimized based on the deviation between the candidate recognition result and the optimal recognition result, and the optimized parameter configuration is generated. In some embodiments, the OCR parameters are dynamically optimized based on the deviation between the candidate recognition result and the optimal recognition result to generate an optimized parameter configuration, including: The candidate recognition results are compared with the best recognition results, and the corresponding error types are analyzed based on differences in character content, text structure, and spatial position. Error types include missing characters, character concatenation, character breakage, text direction errors, and line structure misalignment. Specifically, when the candidate recognition result has fewer characters, missing character content, or incomplete character structure compared to the optimal recognition result, analysis is performed based on the image features of the corresponding region. If a character at the corresponding position is not recognized, it is determined to be a missing character; if the character region has obvious breaks or local discontinuities, it is determined to be a broken character. When a single character in the candidate recognition result does not match multiple characters in the optimal recognition result, the character spacing and pixel connectivity of the corresponding region are analyzed. If multiple character regions have connectivity or abnormal spacing, it is determined to be character adhesion. When the candidate recognition result has abnormal text order or inconsistent semantic direction, analysis is performed based on the text direction detection results and text box direction information. If the detected text direction is inconsistent with the preset text direction, it is determined to be an incorrect text direction. When the candidate recognition result has abnormal line breaks, abnormal reading order, or discontinuous context structure, analysis is performed based on the text box coordinate order and page structure information. If the text box arrangement order does not conform to the preset layout rules, it is determined to be a line structure misalignment.
[0054] Based on the mapping relationship between error types and OCR parameters, the OCR parameters are dynamically optimized and optimized parameter configurations are generated.
[0055] Based on the error analysis results, specific candidate recognition results are located. The corresponding OCR parameters for these results are dynamically adjusted to generate optimized parameter configurations. The OCR recognition strategy is then regenerated to execute the next round of the OCR recognition process, thus forming a closed-loop optimization mechanism. For example, when missing characters are detected, the text detection threshold is increased or image contrast is enhanced; when characters are detected to be stuck together, the binarization threshold is adjusted or image sharpening intensity is reduced; when characters are detected to be broken, the denoising intensity is reduced or segmentation parameters are adjusted; when text direction errors are detected, text direction parameters are adjusted; when line structure misalignment is detected, layout analysis parameters or line spacing thresholds are adjusted. In this embodiment, when a candidate recognition result does not meet preset conditions, the process automatically switches to another set of OCR parameters and re-executes the recognition process to improve recognition accuracy.
[0056] S63, if the preset conditions are met, the candidate recognition results are verified, and the candidate recognition results that pass the verification are output as the final valid recognition results.
[0057] In some embodiments, the candidate recognition results are validated, and the candidate recognition results that pass the validation are output as the final valid recognition results, including: Extract the character confidence information corresponding to the candidate recognition results; The candidate recognition results are structured and parsed to extract text feature information, which includes text length, field content, field format, and key field information. Based on character confidence information and text feature information, the candidate recognition results are verified using a verification strategy. If any verification fails, the current candidate recognition result is intercepted and labeled as low quality, triggering parameter adaptive adjustment or directly initiating a retry mechanism; If all verifications pass, the current candidate recognition result will be output as the final valid recognition result.
[0058] In this embodiment, the optimal recognition result is verified first. If the verification passes, it is directly output as the final valid recognition result.
[0059] In some embodiments, the verification strategy is one or more combinations of character length-based verification, key field integrity-based verification, confidence threshold-based verification, rule matching-based verification, and semantic consistency-based verification; the parameter adjustment process can be implemented using a fixed parameter switching method, a condition-triggered method, or a loop optimization method.
[0060] Character length-based verification: The character length of the candidate recognition result is compared with a preset length range. If it exceeds the preset length range, it is judged as an abnormal result.
[0061] Verification based on the integrity of key fields: Detect whether the candidate recognition results contain preset key fields. If there are missing fields, the results are judged as incomplete.
[0062] Confidence threshold-based verification: Calculate the average confidence of the candidate recognition results and compare it with a preset confidence threshold. If it is lower than the preset confidence threshold, it is judged as a low-confidence result.
[0063] Rule-based verification: Verify the format validity of candidate recognition results according to preset format rules or regular expressions.
[0064] Semantic consistency-based verification: Perform semantic analysis on the text of the candidate recognition results to determine whether there are semantic conflicts, logical inconsistencies or abnormal field associations in the text content.
[0065] The verification strategy can be configured according to different business scenarios. For example, it can be set to trigger a re-recognition process when the average confidence of the candidate recognition results is lower than 75%, or to switch to another set of OCR parameters when a key field is detected to be missing.
[0066] Please see Figure 3 As shown, another aspect of this application embodiment also provides an OCR parameter adaptive optimization system based on semantic consistency feedback. The OCR parameter adaptive optimization system includes: The image preprocessing module is used to acquire the image to be recognized and preprocess the image to obtain a preprocessed image; The image feature extraction module is used to extract image features from the preprocessed image to obtain the image feature vector; The parameter generation module is used to establish the correspondence between image feature vectors and OCR parameters, and generate multiple sets of valid OCR parameter configurations based on the correspondence and the current image feature vectors. The multi-strategy recognition module is used to construct corresponding OCR recognition strategies based on multiple sets of valid OCR parameter configurations, and to recognize the current image to be recognized based on the OCR recognition strategies to obtain multiple sets of candidate recognition results; The semantic consistency evaluation module is used to evaluate the semantic consistency of multiple candidate recognition results to obtain semantic scores, sort them based on the semantic scores, and output the optimal recognition result. The semantic consistency evaluation includes text semantic rationality evaluation, context consistency evaluation, text structure integrity evaluation, and field matching integrity evaluation. The parameter feedback optimization module is used to perform error analysis and verification on the best recognition results, optimize the OCR parameter configuration, and output the final effective recognition results.
[0067] The functional modules in this application system can be deployed on the same device or on different devices to achieve collaborative processing through network communication. The modules can interact with each other through function calls, interface calls or message communication to form a closed-loop optimization process for OCR parameters. The specific implementation form does not constitute a limitation.
[0068] This application is not only applicable to general document text recognition scenarios, but also to scenarios such as invoice recognition, form recognition, contract recognition, certificate recognition, industrial logo recognition, and screenshot text extraction. In different application scenarios, this application can improve the OCR recognition effect through parameter adjustment mechanism.
[0069] The multi-strategy recognition module of this application can be implemented using any OCR engine with text detection and text recognition capabilities, such as open-source OCR tools, commercial OCR services, or custom OCR recognition programs. In different implementations, the multi-strategy recognition module can adopt a single-model recognition method or a method that separates text detection and text recognition.
[0070] It is understood that the content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0071] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0072] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0073] Please see Figure 4 , Figure 4 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes: The processor 401 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 402 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 402 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 402 and is called and executed by the processor 401 using the methods described in the embodiments of this application. Input / output interface 403 is used to implement information input and output; The communication interface 404 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 405 transmits information between various components of the device (e.g., processor 401, memory 402, input / output interface 403, and communication interface 404); The processor 401, memory 402, input / output interface 403 and communication interface 404 are connected to each other within the device via bus 405.
[0074] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.
[0075] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0076] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0077] It is understood that the content of the above method embodiments is applicable to the embodiments of this program product. The specific functions implemented by the embodiments of this program product are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0078] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0079] This application provides a method and system for adaptive optimization of OCR parameters based on semantic consistency feedback. The scheme acquires the image to be recognized and preprocesses it to obtain a preprocessed image. Preprocessing eliminates interference problems such as tilt, noise, and uneven brightness in the original image, weakens irrelevant background information, highlights text regions, and improves image quality. This provides a stable and standardized image data source for subsequent image feature extraction and OCR text recognition, reducing the negative impact of image defects on the recognition accuracy of subsequent processes. Image features are extracted from the preprocessed image to obtain image feature vectors. These vectors quantify and characterize multi-dimensional image attributes such as image sharpness, brightness distribution, contrast, noise level, tilt angle, text direction, and page structure, transforming unstructured image information into computer-calcifiable and matchable standardized image feature vectors. This achieves an objective digital description of image quality, providing a quantitative basis for subsequent intelligent matching and adaptation of OCR parameters, thus breaking away from the mode of solely relying on manual experience to select recognition parameters.
[0080] A correspondence between image feature vectors and OCR parameters is established, and multiple sets of effective OCR parameter configurations are generated by combining the current image feature vectors. Based on the quality features of the current image itself, basic OCR parameters are adaptively matched, and multiple sets of differentiated candidate parameter schemes are generated through parameter perturbation. Instead of using a single fixed parameter for recognition, multiple adaptation schemes are generated for the same image, covering the optimal parameter possibilities under different image defect scenarios. Based on the multiple sets of effective OCR parameter configurations, corresponding OCR recognition strategies are constructed to recognize the current image to be recognized, obtaining multiple sets of candidate recognition results. Multiple independent OCR recognition strategies are used in parallel to perform text detection and character recognition. Multiple versions of candidate recognition text with different versions are generated for the same input image, fully leveraging the recognition advantages of different parameter configurations. Content that is missed or misrecognized by a single parameter can be corrected under other parameter strategies, enriching the candidate result space and increasing the probability of obtaining high-quality recognized text.
[0081] Semantic consistency is evaluated on multiple candidate recognition results to obtain semantic scores. Based on these scores, the optimal recognition result is output. This approach overcomes the limitations of traditional OCR, which relies solely on image-level confidence scores for result selection. It comprehensively evaluates the rationality of the recognized text from multiple dimensions, including natural language semantics, text structure, and document fields. Semantic information is used to filter the optimal candidate text based on logical coherence, structural integrity, and high field matching, effectively filtering results with high character confidence but semantic incoherence or containing typos and garbled characters, significantly improving the usability of the output text. Error analysis and verification are performed on candidate recognition results, providing feedback to optimize OCR parameter configuration and outputting the final effective recognition result. Based on the optimal recognition result, error tracing is conducted, analyzing the defects in the OCR parameters matched with the current image features, and continuously iterating and updating the mapping relationship between image features and OCR parameters. This forms a closed-loop adaptive optimization mechanism of image recognition—semantic evaluation—parameter feedback, effectively improving OCR recognition accuracy.
[0082] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0083] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0084] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0085] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0086] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A method for adaptive optimization of OCR parameters based on consistency feedback, characterized in that, The adaptive optimization method for OCR parameters includes: The image to be identified is acquired and preprocessed to obtain a preprocessed image; Extract the image features from the preprocessed image to obtain the image feature vector; Establish a correspondence between image feature vectors and OCR parameters, and generate multiple sets of valid OCR parameter configurations based on the correspondence and the current image feature vector; Based on multiple sets of valid OCR parameter configurations, a corresponding OCR recognition strategy is constructed. Based on the OCR recognition strategy, the current image to be recognized is recognized to obtain multiple sets of candidate recognition results. Semantic consistency evaluation is performed on multiple groups of candidate recognition results to obtain semantic scores. The results are then ranked based on the semantic scores, and the optimal recognition result is output. The semantic consistency evaluation includes text semantic rationality evaluation, contextual consistency evaluation, text structural integrity evaluation, and field matching integrity evaluation. Error analysis and verification are performed on the candidate recognition results, feedback is provided to optimize the OCR parameter configuration, and the final valid recognition result is output.
2. The OCR parameter adaptive optimization method according to claim 1, characterized in that, The image features include image sharpness, image brightness distribution, image contrast, image noise level, image tilt angle, text direction features, and page structure features.
3. The OCR parameter adaptive optimization method according to claim 1, characterized in that, Establish a correspondence between image features and OCR parameters, and generate multiple sets of valid OCR parameter configurations based on the correspondence and the current image feature vector, including: Based on the image feature vectors of historical images to be identified and the corresponding optimal OCR parameters, a mapping relationship library between the image feature vectors and OCR parameters is constructed. Using the current image feature vector of the image to be processed as input, the baseline parameter configuration is obtained by retrieving the mapping relationship library based on similarity matching; Based on the benchmark parameters, parameter perturbation sampling is performed to generate multiple sets of candidate OCR parameter configurations; Boundary validation is performed on the candidate OCR parameter configurations, and multiple sets of valid OCR parameter configurations are output.
4. The OCR parameter adaptive optimization method according to claim 3, characterized in that, The OCR parameters can be configured in one or more combinations of manual preset parameters, rule-based parameter configuration, experience-based parameter configuration based on historical recognition results, and parameter switching based on image quality. The OCR parameters include binarization threshold, image scaling ratio, denoising parameters, image enhancement parameters, text detection threshold, text direction parameters, character segmentation parameters, and recognition confidence threshold.
5. The OCR parameter adaptive optimization method according to claim 1, characterized in that, Based on multiple sets of valid OCR parameter configurations, a corresponding OCR recognition strategy is constructed. The current image to be recognized is then recognized based on this OCR recognition strategy, yielding multiple sets of candidate recognition results, including: Based on multiple sets of valid OCR parameter configurations, a corresponding OCR recognition strategy is constructed to obtain a set of recognition strategies. Based on the set of recognition strategies, perform image preprocessing operations on the current image to be recognized to obtain a preprocessed image set; Using the preprocessed image set as input, text detection is performed based on the text recognition model to obtain the text detection results; The text region is cropped based on the text detection results, and the text region is input into the character recognition model for character recognition to obtain the character recognition results. Based on the text detection results and character recognition results, the layout structure is analyzed to obtain multiple sets of candidate recognition results.
6. The OCR parameter adaptive optimization method according to claim 1, characterized in that, Error analysis and verification are performed on the candidate recognition results, feedback is provided to optimize the OCR parameter configuration, and the final valid recognition result is output, including: Determine whether the semantic score of the candidate recognition result meets the preset conditions; If the preset conditions are not met, the OCR parameters are dynamically optimized based on the deviation between the candidate recognition result and the optimal recognition result to generate an optimized parameter configuration. If the preset conditions are met, the candidate recognition results are verified, and the candidate recognition results that pass the verification are output as the final valid recognition results.
7. The OCR parameter adaptive optimization method according to claim 6, characterized in that, Based on the deviation between the candidate recognition result and the optimal recognition result, the OCR parameters are dynamically optimized to generate an optimized parameter configuration, including: The candidate recognition results are compared with the optimal recognition results, and the corresponding error types are analyzed based on differences in character content, text structure, and spatial position. The error types include missing characters, character concatenation, character breakage, text direction errors, and line structure misalignment. Based on the mapping relationship between the error type and the OCR parameters, the OCR parameters are dynamically optimized and an optimized parameter configuration is generated.
8. The OCR parameter adaptive optimization method according to claim 6, characterized in that, The candidate recognition results are verified, and the candidate recognition results that pass the verification are output as the final valid recognition results, including: Extract the character confidence information corresponding to the candidate recognition results; The candidate recognition results are subjected to structured parsing and text feature information is extracted. The text feature information includes text length, field content, field format and key field information. Based on the character confidence information and text feature information, the candidate recognition results are verified according to the verification strategy; If any verification fails, the current candidate recognition result is intercepted and labeled as low quality, triggering parameter adaptive adjustment or directly initiating a retry mechanism; If all verifications pass, the current candidate recognition result will be output as the final valid recognition result.
9. An OCR parameter adaptive optimization system based on semantic consistency feedback, applied to the OCR parameter adaptive optimization method according to any one of claims 1 to 8, characterized in that, The OCR parameter adaptive optimization system includes: An image preprocessing module is used to acquire an image to be identified and preprocess the image to be identified to obtain a preprocessed image; The image feature extraction module is used to extract image features from the preprocessed image to obtain an image feature vector; The parameter generation module is used to establish the correspondence between image feature vectors and OCR parameters, and generate multiple sets of valid OCR parameter configurations based on the correspondence and the current image feature vector; The multi-strategy recognition module is used to construct a corresponding OCR recognition strategy based on multiple sets of valid OCR parameters, and to recognize the current image to be recognized based on the OCR recognition strategy to obtain multiple sets of candidate recognition results. The semantic consistency evaluation module is used to evaluate the semantic consistency of multiple candidate recognition results to obtain semantic scores, sort them based on the semantic scores, and output the optimal recognition result. The semantic consistency evaluation includes text semantic rationality evaluation, context consistency evaluation, text structure integrity evaluation, and field matching integrity evaluation. The parameter feedback optimization module is used to perform error analysis and verification on the optimal recognition result, optimize the OCR parameter configuration, and output the final effective recognition result.
10. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method according to any one of claims 1 to 8.