OCR error and omission detection method based on deep learning
By combining deep learning, conditional random fields, extreme gradient boosting and Bayesian correction methods, the recognition errors and omissions of the OCR system in complex backgrounds and multi-language environments are solved, achieving efficient and accurate error and omission detection and correction, and enhancing Improve the system's robustness and adaptability.
Patent Information
- Application Number
- CN202410718058.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-06-05
AI Technical Summary
Existing OCR systems have many recognition errors and omissions in complex backgrounds, noise interference, and multi-language environments. They have insufficient error and omission detection and correction capabilities, and cannot fully utilize contextual information and sequence dependencies.
Combining deep learning, conditional random fields, extreme gradient boosting and Bayesian correction methods, features are extracted through convolutional neural networks, recursive neural tensor networks are used for feature representation learning, conditional random fields are used for sequence annotation, and extreme gradient boosting is used for error and omission detection. and corrected using Bayesian methods.
It significantly improves the accuracy and correction capabilities of error and omission detection, enhances the robustness and adaptability of the system, and can handle complex and changeable text data more accurately.
Smart Images

Figure CN118298445B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of character recognition, and in particular relates to an OCR error and omission detection method based on deep learning. Background Art
[0002] Optical Character Recognition (OCR) technology is a key technology for converting printed or handwritten text into editable and searchable digital text. OCR technology is widely used in digital information management, document processing, automated office and other fields. With the rapid development of deep learning and artificial intelligence technology, OCR technology has made significant progress, especially in complex scenes and multilingual environments. The accuracy of text recognition has been greatly improved. However, the existing OCR system still faces many challenges and problems in practical applications, especially the deficiencies in error detection and correction, which limits its performance in high-precision application scenarios.
[0003] Although deep learning-based OCR technology has significantly improved recognition accuracy, it still faces some challenges and problems in practical applications, especially in error detection and correction. Existing OCR systems are prone to recognition errors and omissions in complex backgrounds, noise interference and multilingual environments. For example, the similarity between characters, the diversity of handwriting and the ambiguity of printed fonts can all lead to recognition errors. Existing methods mainly rely on rules and statistical models, which cannot fully utilize contextual information and sequence dependencies, resulting in low accuracy in error detection. Even if errors are detected, existing systems have limited correction capabilities. Most systems use simple rules or dictionary matching methods for correction, which cannot dynamically adapt to different scenarios and text content. Probabilistic correction methods such as Bayesian methods are effective, but they are still insufficient when dealing with complex language and contextual relationships. Although the CNN and RNN modules in deep learning OCR systems are powerful in their own right, there is still room for optimization in their combination. The separation of feature extraction and sequence processing makes it difficult for the system to capture high-order features and sequence dependencies, affecting the overall recognition effect. Existing systems often ignore the importance of contextual information when dealing with error detection. Although the context window method can utilize the information of previous and next moments to a certain extent, it is still insufficient in capturing complex sequence relationships and high-order dependencies. Summary of the invention
[0004] The main purpose of the present invention is to provide an OCR error detection method based on deep learning. The present invention provides an efficient, accurate and flexible OCR error detection scheme by combining deep learning, conditional random fields, extreme gradient boosting and Bayesian correction methods. This multi-level, multi-model collaborative processing method significantly improves the error detection and correction capabilities of the system, enhances the robustness and adaptability of the system when processing complex and variable text data, and provides solid technical support for the realization of a high-precision OCR system.
[0005] In order to solve the above problems, the technical solution of the present invention is achieved as follows:
[0006] An OCR error and omission detection method based on deep learning, the method comprising:
[0007] Step 1: Preprocess the target text image to obtain a preprocessed image;
[0008] Step 2: Use a convolutional neural network to extract features from the preprocessed image; input the extracted features into a recursive neural tensor network for feature representation learning, and output the hidden state at each moment;
[0009] Step 3: Use conditional random fields to sequence the hidden states output by the recursive neural tensor network; then use the extreme gradient boosting method to detect errors and omissions in the hidden states after sequence annotation to detect the locations of errors and omissions;
[0010] Step 4: Use the Bayesian method to correct the detected error and omission positions and output the corrected error and omission positions.
[0011] Furthermore, step 1 specifically includes:
[0012] Step 1.1: After normalizing the target text image, the target text image is processed using adaptive noise suppression and nonlinear image enhancement technology to obtain a first intermediate result;
[0013] Step 1.2: Convert the first intermediate result into a grayscale image; convert the grayscale image into a black and white image;
[0014] Step 1.3: Perform OCR character segmentation on the black and white image to obtain a preprocessed image.
[0015] Furthermore, in step 1.1, when the target text image is processed using the adaptive noise suppression technique, the noise is regarded as a multi-scale autoregressive process, and the target text image after the adaptive noise suppression process is obtained using the following formula: :
[0016] ;
[0017] in, is the target text image; is Fourier transform; is the inverse Fourier transform; It is a preset adjustment parameter to control the noise suppression strength. The larger the value, the stronger the noise suppression; is the noise estimate; is the multi-scale autoregressive weight; is the number of multi-scale layers; is the autoregression coefficient; is an autoregressive operation; is the number of autoregressive layers.
[0018] Furthermore, when the target text image is processed using nonlinear image enhancement technology, the target text image after adaptive noise suppression is processed using the following formula: The logarithmic domain and generalized domain are processed to obtain the first intermediate result :
[0019] ;
[0020] in, is the hyperbolic tangent function; is the enhancement coefficient; is a logarithmic operation; is the hyperbolic cosine function; is the generalized domain weight; is the number of generalized domain layers; is the preset adjustment parameter; The target text image after adaptive noise suppression The pixel mean of ; for The Gaussian kernel of the generalized domain, The shape parameter of the Gaussian kernel of the generalized domain of the layer is equal to .
[0021] Furthermore, the recursive neural tensor network in step 2 is expressed using the following formula:
[0022] ;
[0023] in, is the first image extracted by the convolutional neural network from the preprocessed image. Features of time steps; is the weight matrix from feature to hidden state; is the weight matrix from hidden state to hidden state; is a tensor parameter used to capture high-order interactions between features and hidden states; is the weight matrix of fusion features and hidden states; is the tensor product operation; is the Hadamard product; is a sine function, used to add nonlinear transformation; is the projection matrix, which is used to transform the input features; is the bias vector; For the The hidden state of time steps; For the The hidden state at time step.
[0024] Furthermore, Used to convert features to hidden states, its dimensions should match the dimensions of features and hidden states; let the dimension of the input feature vector be , the dimension of the hidden state is , The dimension is ; It is used to convert the hidden state of the previous time step to the hidden state of the current time step, whose dimension matches the dimension of the hidden state; let the dimension of the hidden state be , The dimension is ; is a three-dimensional tensor with dimensions .
[0025] Furthermore, in step 3, after the hidden states output by the recursive neural tensor network are sequence labeled using the conditional random field, a label corresponding to each hidden state is obtained as a sequence labeling result; the energy function of the conditional random field is expressed using the following formula:
[0026] ;
[0027] in, is a hidden state sequence, each element is , is the number of elements in the hidden state sequence, which is equal to the number of elements in the label sequence; is a label sequence, each element is ; Indicated in The label corresponding to the hidden state of the time step; Represents the label transfer matrix, each element represents the transfer score between labels, where Representation Tags arrive transfer score; is the label scoring matrix, For label Ratings; is the high-order feature interaction weight matrix, For label The weight vector of A device for a matrix; is the order of high-order feature interaction, indicating how many time steps ago the hidden state will affect the value of the current energy function; is the mean of the hidden state sequence, which is used to calculate the difference in the regularization term; is the weight of the adaptive regularization term, which controls the regularization strength; is a subscript; is the second-order L1 norm.
[0028] Furthermore, the probability function of the conditional random field is Use the following formula to express it:
[0029] ;
[0030] in, Represents the set of all possible tag sequences.
[0031] Furthermore, in step 3, the extreme gradient boosting method is used to detect errors and omissions in the hidden state after sequence annotation, and the method for detecting the error and omission positions includes: using the sequence annotation results and the corresponding hidden states output by the conditional random field as training data; constructing an extreme gradient boosting model, using the hidden state as input features, and using the sequence annotation results as output; for each hidden state, extracting its feature vector, including the hidden states of the three moments before and after, to form a context window to capture sequence information; for each hidden state, using the sequence annotation results as supervision information; using the training data to train the extreme gradient boosting model; during the training process, by continuously adjusting the model parameters, minimizing the loss function to improve the accuracy of the model for error and omission detection; for new target text images, using the trained extreme gradient boosting model to detect errors and omissions in the hidden state after sequence annotation to detect the error and omission positions; the loss function is a cross entropy loss function.
[0032] The OCR error detection method based on deep learning of the present invention has the following beneficial effects: by using conditional random field (CRF) to perform sequence labeling on the hidden state output by recursive neural tensor network (RNTN), the present invention effectively captures the dependency between labels and the matching degree between labels and hidden states. CRF uses its powerful sequence modeling ability to ensure the overall coherence and accuracy of the label sequence. On this basis, the extreme gradient boosting (XGBoost) method is introduced to further refine the results of error detection. XGBoost significantly improves the detection accuracy by constructing and combining multiple decision tree models and capturing sequence information using context windows. The context window method not only considers the current hidden state, but also integrates the hidden state information of the previous and next moments, so as to more comprehensively reflect the continuity and dependency of the sequence data. This multi-level and multi-model collaborative processing significantly improves the accuracy of error detection. For the detected error position, the present invention introduces a Bayesian correction method. The Bayesian method calculates the posterior probability by combining prior knowledge and observation data, thereby dynamically adjusting the correction strategy. In a specific implementation, prior knowledge can come from language models, common error patterns, and grammatical semantic rules of text, while observation data comes from previous error detection results. Through Bayes' theorem, the present invention can flexibly adjust the correction strategy according to different scenarios and text content and output the optimal correction result. This method not only improves the accuracy of correction, but also enhances the adaptability of the system when processing complex texts and changing scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 A method flow chart of a deep learning-based OCR error and omission detection method provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0034] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0035] Example 1: Reference Figure 1 , an OCR error and omission detection method based on deep learning, the method comprising:
[0036] Step 1: Preprocess the target text image to obtain a preprocessed image;
[0037] Grayscale is the process of converting a color image into a grayscale image. This step greatly reduces the computational complexity because grayscale images only contain brightness information but not color information, which is sufficient for text recognition. Next, binarization is performed, which converts the grayscale image into a black and white image. This operation makes the contrast between the text area and the background area more obvious, which is convenient for subsequent feature extraction. In order to further improve the image quality, denoising techniques such as median filtering or mean filtering are usually used in the preprocessing process to eliminate random noise in the image. Noise interferes with the clarity of the text, thereby affecting the recognition accuracy of the OCR system. Median filtering effectively removes salt and pepper noise by replacing the target pixel value with the median of the neighboring pixels, while mean filtering smoothes the image by averaging the neighboring pixels to reduce high-frequency noise. In addition, image enhancement techniques such as histogram equalization are also often used to make the text area more prominent and clear by stretching the contrast of the image. These enhancements not only help improve the readability of the text, but also provide clearer and more useful features for subsequent deep learning models. During the preprocessing process, geometric correction operations such as rotation correction and tilt correction may also be performed. Many scanned or photographed text images may be tilted or distorted, which will affect the accuracy of OCR. By detecting the tilt angle of the text and correcting it, the text area can be adjusted to the horizontal or vertical direction to improve the recognizability of the text. This process is usually implemented in combination with algorithms such as image edge detection and Hough transform. For distortion in some cases, the preprocessing process may also involve perspective transformation correction to restore the normal form of the text. In addition, image resizing is also an important part of preprocessing. In order to meet the input requirements of deep learning models, image sizes often need to be normalized. This step not only involves scaling the image to a uniform size, but also maintaining the aspect ratio of the text to avoid distortion caused by stretching or compression. After resizing, the image is also cropped or padded so that all input images have the same size, which is convenient for batch processing and model training.
[0038] Step 2: Use a convolutional neural network to extract features from the preprocessed image; input the extracted features into a recursive neural tensor network for feature representation learning, and output the hidden state at each moment;
[0039] Convolutional neural network (CNN) is a deep learning model specifically designed for processing image data. It extracts hierarchical features of images through multiple layers of convolution operations, and each layer can capture different levels of information, from low-level basic features such as edges and corners to high-level complex shapes and patterns. The core component of CNN is the convolution layer, which slides on the image through a set of learnable filters (or convolution kernels) to perform convolution operations on local areas to extract feature maps. The pooling layer (usually maximum pooling or average pooling) reduces the size of the feature map through downsampling operations while retaining important features, reducing the amount of calculation and improving the noise resistance and generalization ability of the model. After the convolutional neural network extracts the features of the image, these features are input into the recursive neural tensor network (RNTN) for feature representation learning. RNTN is a model that combines the advantages of recursive neural network (RNN) and tensor network, and is particularly suitable for processing sequence data. Compared with traditional RNN, RNTN introduces tensor operations, which can capture more complex relationships and dependency structures. When processing input features, RNTN generates hidden states for each time step by recursively applying the same set of weights. These hidden states not only take into account the current input features, but also contain information from the previous time step, ensuring the coherence and consistency of the sequence information. Specifically, when the features of the preprocessed image are input into RNTN, the model will gradually process these features to generate a series of hidden states. Each hidden state is a feature representation of the current time step, containing information about that time step and all previous time steps. In this way, RNTN can effectively capture the sequence features and temporal dependencies in the image, which is particularly important for processing images containing text. This is because text often has a natural order and context dependency. Through the structure of the recursive neural network, this order information can be retained and utilized, allowing the model to more accurately understand and process the text content in the image. In addition, RNTN's tensor operations can handle higher-dimensional data and complex nonlinear relationships, giving the model stronger expressive power in feature representation learning. This expressive power is not limited to simple character or word recognition, but can also capture more complex text patterns and structures, such as the format of paragraphs, the alignment of text, etc. By combining the image features extracted by the convolutional neural network with the sequence processing capabilities of the recursive neural tensor network, the entire model can achieve a comprehensive understanding and accurate representation of the text information in the image. Compared with traditional OCR methods, which usually rely on manually designed feature extraction and simple sequence processing algorithms, this technical solution achieves automation and efficiency in feature extraction and feature representation learning through a deep learning model. The multi-layer structure of the convolutional neural network can automatically extract high-quality features of the image, avoiding the tediousness and limitations of manually designed features; the recursive neural tensor network uses its powerful sequence processing and tensor computing capabilities to further perform deep representation learning on the features and generate hidden states at each moment.This combination not only improves the precision and robustness of feature extraction, but also makes the model more accurate and reliable when processing complex text images.
[0040] Step 3: Use conditional random fields to sequence the hidden states output by the recursive neural tensor network; then use the extreme gradient boosting method to detect errors and omissions in the hidden states after sequence annotation to detect the locations of errors and omissions;
[0041] Conditional Random Field (CRF) is a probabilistic graphical model for sequence labeling. It performs labeling tasks by modeling the conditional probability of observation sequences and label sequences. The advantage of CRF is that it can simultaneously consider the dependency between input features and labels, thus performing well in sequence labeling tasks. In OCR error detection, the hidden state output by RNTN is used as the input feature of CRF, and CRF labels the state of each time step based on these features. CRF constructs a global conditional probability distribution model by defining feature functions and transfer functions, which allows it to consider not only the features of the current time step, but also the labels of the previous and next time steps when labeling, ensuring the consistency and accuracy of the labeling results. The sequence labeling process of CRF involves calculating the conditional probability distribution of the input features and finding the optimal label sequence through dynamic programming algorithms (such as the forward-backward algorithm). This process makes full use of contextual information, so that the labeling results can better reflect the actual characters and words in the text image. In text recognition, CRF can effectively solve the ambiguity and uncertainty problems between characters and improve the accuracy and robustness of recognition. After completing the sequence labeling, step 3 uses the extreme gradient boosting (XGBoost) method to detect errors and omissions in the annotated hidden state. XGBoost is an ensemble learning method that improves the performance of the model by building and combining multiple weak learners (usually decision trees). The application of XGBoost in error and omission detection utilizes its efficient gradient boosting algorithm to quickly and accurately identify the error and omission locations in the text. In specific operations, XGBoost uses the hidden state after CRF labeling as input features to train a set of decision tree models, and continuously improves the accuracy of the overall model by gradually optimizing the prediction error of each tree. The advantage of XGBoost is that it can handle large-scale data and has strong generalization and anti-overfitting capabilities. In the error and omission detection task, XGBoost can accurately detect the error and omission locations in the text by learning the complex relationship between features and error and omission labels. In addition, XGBoost also has the advantages of handling missing values, supporting parallel computing, and automatic feature selection, which makes it perform well in practical applications. Through further processing of the CRF labeling results, XGBoost can improve the results of sequence labeling to a higher level of accuracy and reliability. Combining CRF and XGBoost has significant advantages in OCR error detection. CRF uses its powerful sequence annotation capabilities to generate reliable label sequences for each time step, while XGBoost further performs fine error detection on these labels. This combination method not only fully utilizes the advantages of each, but also achieves efficient detection of error locations in text images through synergy. Compared with traditional OCR error detection methods, this technical solution combining deep learning and ensemble learning is significantly innovative.Traditional methods often rely on simple statistical models or rules, while this method achieves full process optimization from feature extraction, sequence labeling to error and omission detection through feature extraction and representation learning of deep learning models, combined with CRF sequence labeling and XGBoost error and omission detection. This comprehensive approach greatly improves the performance of the OCR system, enabling it to more accurately and efficiently identify and correct errors and omissions when processing complex text images. Through this multi-level, multi-model collaborative processing, step 3 plays a key role in the OCR error and omission detection method. It not only improves the accuracy of sequence labeling and error and omission detection, but also provides reliable basic data for subsequent error and omission correction, enabling the entire system to achieve efficient and accurate text recognition and error correction functions.
[0042] Step 4: Use the Bayesian method to correct the detected error and omission positions and output the corrected error and omission positions.
[0043] The Bayesian method is a statistical method based on probabilistic inference. It combines prior probabilities and observed data to calculate posterior probabilities and make decisions. In OCR error detection, the Bayesian method is used to process the detected error locations and correct them based on the model and data. The core of this process is to use Bayes' theorem to combine the detected error information with existing prior knowledge to obtain more reliable correction results. The Bayesian method requires the definition of prior probabilities, that is, the expectations of the error locations before there are observed data. These prior probabilities can come from many aspects, such as the grammatical rules of the text, common spelling error patterns, contextual information, etc. In the OCR system, prior knowledge can be based on the statistical data of the language model, such as the frequency of occurrence of certain characters or words in a specific context. This prior knowledge provides an initial probability distribution for the Bayesian method, giving it a reasonable basis for processing observed data. Next, the observed data comes from the error locations detected by CRF and XGBoost in the previous step. The Bayesian method regards these observed data as evidence, combines the prior probabilities, and updates the probability distribution of the error locations through Bayes' theorem. The essence of this process is to correct prior knowledge through observation data, so as to obtain a posterior probability that is closer to the actual situation. In OCR error correction, this means using the detection results and prior knowledge to re-evaluate each potential error position and determine its most likely true position. Through the correction of the Bayesian method, the false positives and negatives in error detection can be effectively reduced. For example, if a character is detected as an error, but in the prior knowledge, the probability of the character appearing in the current context is high, then the Bayesian method will reduce the possibility of it being considered an error, and vice versa. In this way, the Bayesian method improves the accuracy of error correction by dynamically adjusting the error probability. Another important aspect of Bayesian correction is its adaptability. With the introduction of more observation data, the Bayesian method can continuously update its prior knowledge, making it highly adaptable when facing different types of text and different language environments. This adaptability is very important for the OCR system to handle diverse text inputs, and to maintain high-precision error correction capabilities in various complex situations. In addition, the Bayesian method has unique advantages in dealing with uncertainty and ambiguity. When recognizing text, the OCR system often encounters blurred or unclear character images. At this time, direct character recognition may have large errors. The Bayesian method can make up for the lack of image information to a certain extent and provide more reliable correction results by combining multiple information sources (such as context, character frequency, etc.). By using the Bayesian method for error and omission correction, this technical solution not only improves the overall accuracy of the OCR system, but also enhances the robustness and adaptability of the system. Compared with traditional error and omission correction methods, the advantage of the Bayesian method is that it can comprehensively consider multiple information sources and dynamically adjust the probability distribution, thereby providing more accurate and reliable correction results.This correction method based on probability inference enables the OCR system to effectively reduce false positives and negatives when processing various complex texts, and improve the accuracy and consistency of text recognition.
[0044] Embodiment 2: Step 1 specifically comprises:
[0045] Step 1.1: After normalizing the target text image, the target text image is processed using adaptive noise suppression and nonlinear image enhancement technology to obtain a first intermediate result;
[0046] Step 1.2: Convert the first intermediate result into a grayscale image; convert the grayscale image into a black and white image;
[0047] Step 1.3: Perform OCR character segmentation on the black and white image to obtain a preprocessed image.
[0048] Specifically, the main purpose of normalization is to standardize the size and brightness range of the image to reduce the differences between images. This process ensures that all images have consistent formats and characteristics when they are input to the subsequent processing stage, which facilitates unified processing. The specific operation usually includes scaling the image size to a predetermined size and adjusting the pixel value to a uniform range (such as grayscale values from 0 to 255). Adaptive noise suppression refers to dynamically adjusting the parameters of the noise suppression algorithm according to the specific noise situation of the image to remove image noise in the best way. Common noise suppression techniques include Gaussian filtering, median filtering, and bilateral filtering. Adaptive noise suppression analyzes the noise characteristics of the local area of the image and selects the appropriate filter type and parameters so that the noise is effectively suppressed while retaining the detailed information of the text as much as possible. Nonlinear image enhancement technology is used to enhance the contrast and details of the image to make the text area clearer. Common nonlinear image enhancement methods include histogram equalization and contrast-limited adaptive histogram equalization (CLAHE). Histogram equalization adjusts the grayscale distribution of the image to make the contrast more uniform and significant, while CLAHE performs equalization in the local area to avoid noise amplification caused by excessive enhancement.
[0049] After the first intermediate result is obtained, grayscale conversion is to convert the color image into a grayscale image. This step significantly reduces the computational complexity of the image because the grayscale image only contains brightness information but not color information. Common grayscale conversion methods include weighted averaging (calculating grayscale values based on the sensitivity of the human eye to different colors) and decolorization (taking the maximum or minimum value in the red, green, and blue channels). Binarization is to convert a grayscale image into a black and white image, that is, to convert each pixel value into pure black or pure white according to a certain threshold. This operation makes the contrast between the text area and the background area more obvious, which is convenient for subsequent feature extraction and character recognition. Binarization can be achieved by a global threshold method (such as the Otsu method) or an adaptive threshold method (such as local threshold processing). The global threshold method determines the optimal threshold based on the grayscale histogram of the entire image, while the adaptive threshold method dynamically adjusts the threshold based on the grayscale characteristics of the local area, which is more suitable for images with uneven lighting.
[0050] After the black and white image is obtained after binarization, the next step is OCR character segmentation. Character segmentation is to segment the characters in the text image one by one for subsequent character recognition. The character segmentation process includes two main steps: connected component analysis and character cutting. Connected component analysis is used to detect connected components in the image, that is, interconnected black pixel areas. Through this analysis, the individual character areas in the image can be separated. Commonly used methods include connected domain labeling algorithm and contour detection algorithm. The connected domain labeling algorithm identifies each character area by scanning the image and marking the interconnected pixel groups; the contour detection algorithm finds the outer contour of the character through edge detection for segmentation. Character cutting is to further segment each character area based on the connected domain analysis to ensure that each character is extracted separately. This step may need to consider the spacing between characters and the noise inside the characters. For example, when dealing with sticky characters, morphological operations (such as erosion and dilation) or watershed algorithms are required for segmentation; while for separated characters, direct cutting can be used.
[0051] Example 3: In step 1.1, when the target text image is processed using the adaptive noise suppression technology, the noise is regarded as a multi-scale autoregressive process, and the target text image after the adaptive noise suppression processing is obtained using the following formula: :
[0052] ;
[0053] in, is the target text image; is Fourier transform; is the inverse Fourier transform; It is a preset adjustment parameter to control the noise suppression strength. The larger the value, the stronger the noise suppression; is the noise estimate; is the multi-scale autoregressive weight; is the number of multi-scale layers; is the autoregression coefficient; is an autoregressive operation; is the number of autoregressive layers.
[0054] Specifically, Fourier transform is used to convert the target text image from time domain to frequency domain. In the frequency domain, each frequency component of the image can be analyzed and processed separately. Noise is usually concentrated in the high-frequency part, while text information is mainly distributed in the low-frequency part. Through Fourier transform, the image is mapped from the spatial domain to the frequency domain, making the processing of noise more intuitive and efficient. In the frequency domain, the frequency components are adjusted by a filter function, and the function of this filter function is to adjust the weights of each frequency according to the noise estimation value. Specifically, the filter function uses the noise estimation value to scale the frequency components, weaken the influence of high-frequency noise, and retain the low-frequency text information. This frequency domain-based processing method can effectively isolate and suppress noise, thereby improving the clarity of the image. Then, the inverse Fourier transform is applied to convert the processed image from the frequency domain back to the time domain to obtain a preliminary denoised image. However, simple frequency domain filtering may cause some loss of detail information, so further time domain processing is required to supplement and improve the denoising effect. The multiscale autoregressive model is introduced here. Multiscale analysis decomposes the image into different scale levels and processes each scale independently to capture the features at different scales. The autoregressive model uses the relationship between image pixels and their neighboring pixels to perform denoising. Specifically, the autoregressive model predicts the value of each pixel by linearly combining the values of neighboring pixels. This method utilizes the local correlation of the image and can suppress noise while retaining edge and texture information. The core of multiscale autoregression is to fuse the processing results of each scale through weighted summation. The processing results of each scale are assigned different weights, which reflect the contribution of each scale in the denoising process. By weighted summation of the results of each scale, the information of each scale can be effectively integrated to further improve the denoising effect. The parameters of the autoregressive model, such as the autoregressive coefficient and the multiscale weight, are dynamically adjusted according to the image characteristics and noise conditions. This adaptive adjustment mechanism enables the model to show good denoising performance in different noise environments. Through this method combining frequency domain and time domain, the preliminary denoised image is processed by multiscale autoregression to obtain the final denoised image. This method, which combines the frequency domain filtering of Fourier transform and the time domain processing of multi-scale autoregressive model, makes full use of the advantages of both, performs noise reduction in different fields, complements each other's strengths and weaknesses, and finally achieves efficient noise suppression. This adaptive noise suppression technology has significant advantages. First, it can dynamically adjust the processing parameters according to the specific characteristics of the noise to achieve adaptive noise suppression. Secondly, through multi-scale analysis, it can effectively suppress noise at different scales while retaining the details and edge information of the image, avoiding the common detail loss problem in traditional single-scale methods. In addition, this method performs well in dealing with complex noise environments, has good robustness and adaptability, and is very suitable for high-precision text recognition scenarios.
[0055] Embodiment 4: When the target text image is processed using nonlinear image enhancement technology, the target text image after adaptive noise suppression is processed using the following formula: The logarithmic domain and generalized domain are processed to obtain the first intermediate result :
[0056] ;
[0057] in, is the hyperbolic tangent function; is the enhancement coefficient; is a logarithmic operation; is the hyperbolic cosine function; is the generalized domain weight; is the number of generalized domain layers; is the preset adjustment parameter; The target text image after adaptive noise suppression The pixel mean of ; for The Gaussian kernel of the generalized domain, The shape parameter of the Gaussian kernel of the generalized domain of the layer is equal to .
[0058] Specifically, the first part of the formula It is to perform a logarithmic transformation on the image. Logarithmic transformation is a commonly used image processing technique that compresses the dynamic range of brightness so that areas with large brightness differences can show details more clearly. Specifically, the logarithmic transformation can compress high brightness values closer together, while keeping low brightness values more different, thereby visually enhancing the contrast of the image. In addition, by adding 1 before the logarithmic operation, the problem of singularities when the logarithmic function processes zero values is avoided, ensuring that all pixel values can be effectively processed. Next, It is the generalized domain processing part. Generalized domain processing involves convolving the image with Gaussian kernels of different scales to extract the features of the image at each scale. Here, the Gaussian kernel Shape parameters and number of layers Related, indicating that Feature extraction on the layer. Convolution operation The function of is to apply the Gaussian kernel to the image, perform smoothing, and extract the features of the local area. The generalized domain processing combines multi-scale information to make the image enhancement effect more comprehensive and delicate. The convolution result of each layer is weighted. The weights are weighted, and these weights reflect the proportion of each scale in the enhancement process, ensuring that the final enhancement effect can integrate information from each scale. After processing, the contrast effect of features of different scales is further expanded. The hyperbolic cosine function is a nonlinear function that grows faster than the linear function and can significantly enhance the contrast of the image, especially in the high-light and low-light areas. Function can enhance the areas with large brightness differences in the image, making the text details more visible. In addition, the formula includes the enhancement coefficient , used to adjust the overall enhancement strength. The value of can control the effect of image enhancement to adapt it to different application requirements. For example, when processing low-contrast text images, you can increase To enhance the contrast of the image, you can adjust the value of The second part of the formula is an adjustment based on pixel values. Here, Represents the pixel mean of the image. By calculating the difference between each pixel and the mean, a weight is generated to suppress high deviation values. Specifically, this part suppresses pixels that deviate from the mean by the negative number of the exponential function. The characteristic of the exponential function is that for larger input values, the output value approaches zero rapidly, and for smaller input values, the output value approaches 1. Therefore, this adjustment item can effectively reduce the impact of extreme values in the image, making the enhanced image more uniform and smooth. Finally, the results of the two parts are added together to obtain the enhanced image. . This nonlinear enhancement method combines logarithmic transformation and generalized domain processing. Through multi-scale feature extraction and nonlinear adjustment, it significantly improves the contrast and details of the image, so that the text information can still be clearly presented in complex background and noisy environment. Compared with traditional linear enhancement methods, this nonlinear image enhancement technology shows higher robustness and adaptability when processing images with high dynamic range and complex background, effectively improving the accuracy and efficiency of text recognition. With this method, the enhanced image is not only visually clearer, but also provides higher quality input images for subsequent OCR character recognition, ensuring the accuracy and reliability of the recognition results.
[0059] Example 5: The recursive neural tensor network in step 2 is represented by the following formula:
[0060] ;
[0061] in, is the first image extracted by the convolutional neural network from the preprocessed image. Features of time steps; is the weight matrix from feature to hidden state; is the weight matrix from hidden state to hidden state; is a tensor parameter used to capture high-order interactions between features and hidden states; is the weight matrix of fusion features and hidden states; is the tensor product operation; is the Hadamard product; is a sine function, used to add nonlinear transformation; is the projection matrix, which is used to transform the input features; is the bias vector; For the The hidden state of time steps; For the The hidden state at time step.
[0062] Specifically, the formula Represents the first The features of the image at that time step. These features contain important information about the image at that time step and are the input of the recurrent neural network (RNN). In order to effectively use these features to update the hidden state, a series of transformations are required. is a linear transformation from features to hidden states, where is the weight matrix. Through this linear transformation, the input feature is mapped to the hidden state space, providing basic information for the current time step. The purpose of this step is to preliminarily process the features so that they adapt to the dimension of the hidden state, thus preparing them for subsequent calculations. Next, Represents the hidden state of the previous time step to the current time step hidden state, where is another weight matrix. The linear transformation is performed, and the state information of the previous time step is passed to the current time step. This state transfer mechanism is the core feature of the recurrent neural network, which ensures that the model can retain and utilize the coherence and historical information of the time series data, so that the calculation of each time step can be based on the context of the previous time step. In order to capture the high-order interaction between features and hidden states, the formula contains This one. is a tensor parameter, and Represents the tensor product operation of features and hidden states. The tensor product operation can calculate all pairs of two vectors, thereby capturing more complex relationships and patterns. Through this high-order interaction, the model can learn deeper feature patterns, so that the update of the hidden state not only depends on the simple combination of the current feature and the previous state, but can reflect the more complex interactions between them. In addition, there is another term in the formula . is another weight matrix, and The Hadamard product (element-wise product) of the feature and the hidden state. The Hadamard product can retain the direct interaction information of each corresponding element in the two vectors, further enriching the expressive power of the feature. Sine function The features are projected and transformed before application, which increases the nonlinear transformation capability of the model. is the projection matrix. Through this nonlinear transformation, the model can more significantly show complex patterns and changes, so that the features can capture more detailed information after the sine transform. The role of the sine function here is to introduce nonlinearity, increase the expressive power of the model, and enable it to handle more complex feature patterns. Bias vector is added to all weighted sums to provide a fixed offset. The bias term ensures that the model has a basic adjustment under all input conditions, making the output more stable and reliable. In neural networks, the bias vector plays a balancing and adjustment role, preventing the model from being too dependent on changes in input data, thereby improving its robustness and generalization ability. The entire formula is obtained through the hyperbolic tangent function As an activation function, all weighted sum results are compressed to the range of [-1, 1]. The function is a commonly used activation function, which not only provides nonlinear transformation, but also compresses the input value range to a fixed interval, making the output of the hidden state smoother and more stable. function, the model can better handle the nonlinear relationship of the input data and perform effective state updates at each time step. The hidden state update formula of the recursive neural tensor network combines a variety of advanced operations and nonlinear transformations, including linear transformations, tensor operations, Hadamard products, and sine function transformations. This complex update mechanism enables the model to capture high-order interaction information between features and hidden states when processing time series data, thereby significantly improving the modeling ability of complex sequence data. In practical applications, this enhanced modeling capability helps to improve the text recognition accuracy and robustness of the OCR system, especially when processing text images with complex backgrounds and noise.
[0063] Embodiment 6: Used to convert features to hidden states, its dimensions should match the dimensions of features and hidden states; let the dimension of the input feature vector be , the dimension of the hidden state is , The dimension is It is used to convert the hidden state of the previous time step to the hidden state of the current time step, whose dimension matches the dimension of the hidden state; let the dimension of the hidden state be , The dimension is ; is a three-dimensional tensor with dimensions .
[0064] Specifically, the weight matrix The role of is to convert the input feature vector to the hidden state. Assume that the dimension of the input feature vector is , the dimension of the hidden state is ,So The dimensions must be . Thus, matrix multiplication The input features can be Mapped to the hidden state space, providing the basic information needed for the current time step. The weight matrix The role of is to convert the hidden state of the previous time step to the hidden state of the current time step. Assume that the dimension of the hidden state is ,So The dimensions must be . Through matrix multiplication , the hidden state at the previous time step is mapped to the current time step, thereby passing contextual information in the calculation of the time series. This process is the core mechanism of the recurrent neural network, ensuring that the model can maintain the memory and utilization of historical information when processing sequence data. The role of is to capture the high-order interactions between features and hidden states. is a three-dimensional tensor with dimensions , represents the multidimensional relationship between the features, the hidden state of the previous time step, and the hidden state of the current time step. Tensor Through tensor product operation The input features and the hidden state of the previous time step are combined to capture the complex interaction information between them. This high-order interaction can not only reflect simple linear relationships, but also express deeper feature patterns, making the model's understanding of sequence data more comprehensive and detailed.
[0065] Embodiment 7: In step 3, after the hidden state output by the recursive neural tensor network is sequence labeled using the conditional random field, a label corresponding to each hidden state is obtained as the sequence labeling result; the energy function of the conditional random field is expressed using the following formula:
[0066] ;
[0067] in, is a hidden state sequence, each element is , is the number of elements in the hidden state sequence, which is equal to the number of elements in the label sequence; is a label sequence, each element is ; Indicated in The label corresponding to the hidden state of the time step; Represents the label transfer matrix, each element represents the transfer score between labels, where Representation Tags arrive transfer score; is the label scoring matrix, For label Ratings; is the high-order feature interaction weight matrix, For label The weight vector of A device for a matrix; is the order of high-order feature interaction, indicating how many time steps ago the hidden state will affect the value of the current energy function; is the mean of the hidden state sequence, which is used to calculate the difference in the regularization term; is the weight of the adaptive regularization term, which controls the regularization strength; is a subscript; is the second-order L1 norm.
[0068] Specifically, the first part of the formula is the label transfer score. This part is obtained by using the label transfer matrix To capture the dependencies between labels in the sequence. Each element of the label transfer matrix Indicates from the label Transfer to label This transfer score reflects the interdependence between labels in sequence data. For example, in a text, the order of certain characters or words is regular, and certain labels may be more likely to follow other labels. By capturing these regularities, CRF can annotate sequences more accurately. The calculation of the label transfer score ensures that the model not only considers the matching of a single label to a feature, but also the overall coherence of the label sequence. This design enables the relationship between labels to be effectively captured, thereby improving the model's ability to understand and process sequence data. The second part is the label score, which is calculated through the label score matrix and hidden state The inner product of is used to calculate the label score for each time step. The label score matrix Each column represents a scoring vector for a label, which is used to evaluate the degree of match between the current hidden state and each possible label. By multiplying the hidden state with the label scoring matrix, the label score corresponding to each hidden state is calculated, thereby reflecting the suitability of the label in the current hidden state. This part directly reflects the match between the hidden state and the label, ensuring that the label selection at each time step is based on the characteristics of the current hidden state. This scoring mechanism enables the model to accurately evaluate the most likely label under each hidden state and improve the accuracy of sequence labeling. The third part is the high-order feature interaction, which is achieved through the high-order feature interaction weight matrix The purpose of high-order feature interactions is to capture more complex dependencies between time steps. Specifically, this part considers the interaction between the hidden state of the current time step and the hidden state of the previous time steps. The current hidden state is combined with the previous hidden state through the element-by-element product (Hadamard product) operation, and weighted by the high-order feature interaction weight matrix to calculate the energy value of the interaction. This high-order feature interaction can capture the complex patterns in the hidden state sequence, allowing the model to better understand and process the intrinsic structure of time series data. For example, in a text sequence, the appearance of certain characters may be affected by the previous characters. This part of the calculation can reveal and utilize these complex dependencies and improve the accuracy of sequence labeling. By introducing high-order feature interactions, CRF is able to handle more complex sequence relationships, thereby showing higher accuracy and robustness in practical applications. Finally, the regularization term is an important part of the energy function, which aims to prevent the model from overfitting. The regularization term penalizes overly complex models by calculating the deviation between each hidden state and the mean of the hidden state sequence and weightedly accumulating the sum of the squares of these deviations. This part penalizes the deviation of the hidden state from its mean to ensure that the hidden state does not deviate too much, thereby enhancing the generalization ability of the model. The strength of regularization is controlled. The larger the weight value, the stronger the regularization effect. This design helps to balance the complexity of the model and the degree of fit of the training data, prevent overfitting on the training data, and ensure that the model performs more robustly on unseen data. The regularization term suppresses excessive fluctuations in the hidden state, allowing the model to show better stability and adaptability when processing new data. The energy function of CRF comprehensively considers the dependencies between labels, the degree of match between hidden states and labels, and the complex patterns of hidden state sequences through a combination of label transfer scores, label scores, and high-order feature interactions, plus regularization terms. This method not only improves the accuracy of sequence labeling, but also enhances the robustness and generalization ability of the model through regularization. In OCR error detection, using CRF to sequence label the hidden state can effectively identify the error locations in the text and significantly improve the accuracy and reliability of text recognition.
[0069] Example 8: Probability function of conditional random field Use the following formula to express it:
[0070] ;
[0071] in, Represents the set of all possible tag sequences.
[0072] Specifically, in this formula, the numerator Through the energy function Calculate label sequence and the hidden state sequence The smaller the value of the energy function, the higher the match between the label sequence and the hidden state sequence, and thus the greater the probability. Used to convert energy values into probabilities, ensuring that the probability values are positive and more suitable for probability distribution calculations. Energy function It contains multiple parts, including label transfer score, label score, and high-order feature interaction. These parts work together to comprehensively evaluate the match between the label sequence and the hidden state sequence. Specifically, the label transfer score captures the dependencies in the label sequence, the label score evaluates the match between each hidden state and the label, and the high-order feature interaction considers the complex relationship between the hidden states at different time steps. By combining this information, the energy function can effectively measure the match between the label sequence and the hidden state sequence. Denominator is the set of all possible label sequences The sum is performed to ensure that the sum of the probabilities of all possible label sequences is 1. This part is called the normalization factor, which ensures that the probability function The output of is a legal probability value. By normalizing all possible label sequences, CRF can compare the relative probabilities of different label sequences to determine the optimal label sequence. In practical applications, calculating the normalization factor in the denominator is a complex task because the number of label sequences may be very large. However, through techniques such as dynamic programming, this part can be calculated efficiently, thereby achieving efficient sequence labeling. The application of this probability function of conditional random fields in OCR error detection is very important. By calculating the probability of each possible label sequence under a given hidden state sequence, CRF can determine the most likely label sequence, thereby accurately marking the error locations in the text. For example, in a text image containing multiple characters, the hidden state sequence may represent the features of each character, and the label sequence represents the actual category of the character. By minimizing the energy function and calculating the probability, CRF can determine the most likely label for each character, thereby achieving accurate character recognition and error detection. In addition, this probability function of the conditional random field is very flexible and adaptable. Since the energy function can contain a variety of different features and information, CRF can handle a variety of complex sequence data and tasks. For example, when processing natural language processing tasks, the energy function can include the dependency between words, the relationship between words and context, etc., so as to achieve accurate part-of-speech tagging, named entity recognition and other tasks. In OCR error detection, the energy function can include the dependency between characters, the relationship between characters and image features, etc., so as to achieve accurate character recognition and error correction.
[0073] Embodiment 9: In step 3, the extreme gradient boosting method is used again to perform error and omission detection on the hidden state after sequence annotation, and the method for detecting the error and omission position includes: using the sequence annotation result output by the conditional random field and the corresponding hidden state as training data; constructing an extreme gradient boosting model, using the hidden state as input feature, and using the sequence annotation result as output; for each hidden state, extracting its feature vector, including the hidden state of the three moments before and after, to form a context window to capture sequence information; for each hidden state, using the sequence annotation result as supervision information; using the training data to train the extreme gradient boosting model; during the training process, by continuously adjusting the model parameters, minimizing the loss function to improve the accuracy of the model for error and omission detection; for a new target text image, using the trained extreme gradient boosting model to perform error and omission detection on the hidden state after sequence annotation to detect the error and omission position; the loss function is a cross entropy loss function.
[0074] Specifically, the hidden state output by the recursive neural tensor network (RNTN) is preliminarily sequence labeled by CRF. CRF is a probabilistic graph model that implements sequence labeling by modeling the dependency between labels and the matching degree between labels and hidden states. In CRF, the energy function is used to measure the matching degree between the label sequence and the hidden state sequence. The lower the energy value, the higher the matching degree. CRF finds the optimal label sequence by maximizing the conditional probability. This process takes into account the transfer score, label score and high-order feature interaction between labels to generate preliminary labels corresponding to each hidden state. However, although CRF has provided relatively accurate preliminary labeling results, in order to further improve the accuracy of error detection, XGBoost is introduced. XGBoost is an ensemble learning algorithm based on gradient boosting. It improves the prediction accuracy by constructing multiple decision tree models and gradually optimizing the loss function. XGBoost performs well in processing large-scale data and has good generalization ability. In the specific implementation, the sequence labeling results output by CRF and the corresponding hidden states are used as training data to build the XGBoost model. In the training data, the hidden state is used as the input feature and the sequence labeling result is used as the output label. In order to capture the context information in the sequence, for each hidden state, not only the features of the current moment are considered, but also the hidden states of the three moments before and after it, forming a context window containing seven moments. This context window method can better reflect the continuity and dependence of the sequence data and improve the accuracy of the model in error and omission detection. During the training process, the XGBoost model uses the cross entropy loss function to measure the difference between the model prediction results and the actual labels. The cross entropy loss function guides the model to continuously adjust parameters and minimize the loss by quantifying the distance between the probability distribution of the model output and the actual label distribution, thereby improving the prediction accuracy. During the training process, the XGBoost model gradually optimizes the parameters to reduce errors and enhance the ability to detect errors and omissions in sequence data. After training, the XGBoost model is used to process new target text images. First, CRF performs sequence annotation on the new image and generates preliminary labels for each hidden state. Then, these sequence-annotated hidden states are input into the trained XGBoost model for further error and omission detection. The XGBoost model uses the features of the hidden states in the context window and combines the relationship between the hidden states and labels learned in training to accurately detect the error locations in the text. The advantage of this method is that it improves the accuracy and robustness of error detection by combining the contextual information of sequence data through the extreme gradient boosting model. Conditional random fields provide preliminary sequence annotations, capturing the dependencies between labels and the matching degree of hidden states, while XGBoost captures sequence information through the context window, further improving the accuracy and reliability of error detection.Through this step-by-step processing method, the model can not only utilize the characteristics of each hidden state, but also combine the overall structural information of the sequence, so that it performs well in processing complex text images. In addition, XGBoost has the ability to process large-scale data and parallel computing, which makes it highly efficient and scalable in practical applications. By continuously adjusting and optimizing model parameters, XGBoost can adapt to different data characteristics and task requirements, and improve the prediction performance and robustness of the model. The use of the cross entropy loss function further ensures the effectiveness of the model in classification tasks. By minimizing the loss function, the model can accurately learn the mapping relationship between hidden states and labels. In practical applications, this method can be widely used in various complex text recognition tasks. For example, when processing text images with complex backgrounds and noise, CRF can provide preliminary sequence labeling results, while XGBoost can further refine these results to ensure that errors and omissions in the text can be accurately detected and identified. In addition, this method can also be applied to other sequence data processing tasks, such as speech recognition, natural language processing, etc., by combining the advantages of CRF and XGBoost to achieve high-precision sequence labeling and error detection.
[0075] Embodiment 10: For the detected error and omission positions, the Bayesian method is used for correction. The goal of this step is to accurately correct the detected error and omission positions through the principle of Bayesian statistics, combined with prior knowledge and observation data, so as to improve the overall accuracy and reliability of the OCR system. The following is a specific implementation process: The first step of the Bayesian method is to define the prior probability, which represents the expectation of the error and omission position when there is no observation data. Prior knowledge can come from a variety of ways, for example: using a language model trained with a large amount of text data to provide the probability of a character or word appearing in a specific context. By analyzing a large number of OCR results, common error and omission patterns are identified, such as the high error recognition rate of certain characters, and certain characters are easily mistaken for other characters. Through natural language processing technology, the grammatical and semantic rules of the text are obtained to assist in determining which characters or words are more likely to appear in a specific position. The observation data comes from the previous error and omission detection step. The error and omission positions detected by the CRF and XGBoost models, as well as the corresponding hidden states and annotation results, constitute the observation data for Bayesian correction. These data provide the actual observation of the current OCR results.
[0076] Use Bayes' theorem to combine the prior probability and the observed data to calculate the posterior probability. The formula of Bayes' theorem is:
[0077] ;
[0078] in, In the observation data Lower Parameters The posterior probability of It is in the parameter The likelihood of observing the data is, is the prior probability of the parameter, is the marginal likelihood of the observed data. Specifically for OCR error correction, assume Indicates the correctness of a character or word in a specific position. Representing the observed error, Bayes' theorem can be used to calculate the posterior probability of each possible character in that position. This posterior probability reflects the likelihood of each character appearing in that position after considering prior knowledge and observed data.
[0079] According to the calculated posterior probability, the character or word with the highest probability is selected as the correction result. The specific steps are as follows: For each detected error position, extract possible candidate characters or words based on prior knowledge and observation data. Use Bayesian theorem to calculate the posterior probability of each candidate character. Select the candidate character with the highest posterior probability as the correction result to replace the detected error character. Replace the original error position with the corrected character or word to generate the final corrected text. This corrected text has been optimized by Bayesian method and has higher accuracy and consistency.
[0080] Assuming that the detected error position is a word in a sentence, the specific steps of correction by Bayesian method are as follows: Through the language model, we know the words that may appear in this position and their probability distribution. For example, the prior probabilities of "the" and "then" in this position are 0.6 and 0.4 respectively. From the error detection step, it is observed that the current word may be mistakenly recognized as "the". Calculate the likelihood probability of each candidate word under the observed data. Combined with the prior probability, use Bayes' theorem to calculate the posterior probability of each candidate word. Select the word with the highest posterior probability. For example, if the posterior probability of "then" is higher than "the", the word in the error position is corrected to "then". Generate the corrected text and replace the word in the original error position with "then". Through the above process, the Bayesian method effectively combines prior knowledge and observation data to achieve accurate correction of the detected error position. This method not only improves the accuracy of the OCR system, but also enhances the robustness and adaptability of the system when dealing with complex text scenarios.
[0081] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. The OCR error and omission detection method based on deep learning is characterized by: The method comprises: Step 1: Preprocess the target text image to obtain a preprocessed image; Step 2: Use a convolutional neural network to extract features from the preprocessed image; input the extracted features into a recursive neural tensor network for feature representation learning, and output the hidden state at each moment; Step 3: Use conditional random fields to sequence the hidden states output by the recursive neural tensor network; then use the extreme gradient boosting method to detect errors and omissions in the hidden states after sequence annotation to detect the locations of errors and omissions; Step 4: Use the Bayesian method to correct the detected error and omission positions, and output the corrected error and omission positions; In step 3, the extreme gradient boosting method is used to detect errors and omissions in the hidden state after sequence annotation. The method for detecting the error and omission positions includes: using the sequence annotation results and the corresponding hidden states output by the conditional random field as training data; constructing an extreme gradient boosting model, using the hidden state as input features, and using the sequence annotation results as output; for each hidden state, extracting its feature vector, including the hidden states of the three moments before and after, to form a context window to capture sequence information; for each hidden state, using the sequence annotation results as supervision information; using the training data to train the extreme gradient boosting model; during the training process, by continuously adjusting the model parameters, minimizing the loss function to improve the accuracy of the model for error and omission detection; for new target text images, using the trained extreme gradient boosting model to detect errors and omissions in the hidden state after sequence annotation to detect the error and omission positions; the loss function is a cross entropy loss function.
2. The OCR error and omission detection method based on deep learning as claimed in claim 1, characterized in that: Step 1 specifically includes: Step 1.1: After normalizing the target text image, the target text image is processed using adaptive noise suppression and nonlinear image enhancement technology to obtain a first intermediate result; Step 1.2: Convert the first intermediate result into a grayscale image; convert the grayscale image into a black and white image; Step 1.3: Perform OCR character segmentation on the black and white image to obtain a preprocessed image.
3. The OCR error and omission detection method based on deep learning as claimed in claim 2, characterized in that: In step 1.1, when the target text image is processed using the adaptive noise suppression technology, the noise is regarded as a multi-scale autoregressive process, and the target text image after the adaptive noise suppression processing is obtained using the following formula: : ; in, is the target text image; is Fourier transform; is the inverse Fourier transform; It is a preset adjustment parameter to control the noise suppression strength. The larger the value, the stronger the noise suppression; is the noise estimate; is the multi-scale autoregressive weight; is the number of multi-scale layers; is the autoregression coefficient; is an autoregressive operation; is the number of autoregressive layers.
4. The OCR error and omission detection method based on deep learning as claimed in claim 2, characterized in that: When the target text image is processed using nonlinear image enhancement technology, the following formula is used to convert the target text image after adaptive noise suppression processing into The logarithmic domain and generalized domain are processed to obtain the first intermediate result : ; in, is the hyperbolic tangent function; is the enhancement coefficient; is a logarithmic operation; is the hyperbolic cosine function; is the generalized domain weight; is the number of generalized domain layers; is the preset adjustment parameter; The target text image after adaptive noise suppression The pixel mean of ; for The Gaussian kernel of the generalized domain, The shape parameter of the Gaussian kernel of the generalized domain of the layer is equal to .
5. The OCR error and omission detection method based on deep learning as claimed in claim 4, characterized in that: The recursive neural tensor network in step 2 is expressed using the following formula: ; in, is the first image extracted by the convolutional neural network from the preprocessed image. Features of time steps; is the weight matrix from feature to hidden state; is the weight matrix from hidden state to hidden state; is a tensor parameter used to capture high-order interactions between features and hidden states; is the weight matrix of fusion features and hidden states; is the tensor product operation; is the Hadamard product; is a sine function, used to add nonlinear transformation; is the projection matrix, which is used to transform the input features; is the bias vector; For the The hidden state of time steps; For the The hidden state at time step.
6. The deep learning-based OCR error and omission detection method according to claim 5, characterized in that: Used to convert features to hidden states, its dimensions should match the dimensions of features and hidden states; let the dimension of the input feature vector be , the dimension of the hidden state is , The dimension is ; It is used to convert the hidden state of the previous time step to the hidden state of the current time step, whose dimension matches the dimension of the hidden state; let the dimension of the hidden state be , The dimension is ; is a three-dimensional tensor with dimensions .
7. The deep learning-based OCR error and omission detection method according to claim 6, characterized in that: In step 3, after the hidden state output by the recursive neural tensor network is sequence labeled using the conditional random field, a label corresponding to each hidden state is obtained as the sequence labeling result; the energy function of the conditional random field is expressed using the following formula: ; in, is a hidden state sequence, each element is , is the number of elements in the hidden state sequence, which is equal to the number of elements in the label sequence; is a label sequence, each element is ; Indicated in The label corresponding to the hidden state of the time step; Represents the label transfer matrix, each element represents the transfer score between labels, where Representation Tags arrive transfer score; is the label scoring matrix, For label Ratings; is the high-order feature interaction weight matrix, For label The weight vector of A device for a matrix; is the order of high-order feature interaction, indicating how many time steps ago the hidden state will affect the value of the current energy function; is the mean of the hidden state sequence, which is used to calculate the difference in the regularization term; is the weight of the adaptive regularization term, which controls the regularization strength; is a subscript; is the second-order L1 norm.
8. The deep learning-based OCR error and omission detection method according to claim 7, characterized in that: Probability function of conditional random field Use the following formula to express it: ; in, Represents the set of all possible label sequences.
Citation Information
Patent Citations
Image Semantic Segmentation Method Based on Deep Full Convolutional Network and Conditional Random Field
AU2020103901A4
Sequence labeling method, device and equipment
CN112989801A
