Text recognition method and system for power auditing business
By using a combination of OCR technology and BiLSTM model in power audit business, the traditional text recognition method is solved, and the problem of inefficiency and error-prone in complex power audit business is achieved, and efficient and accurate text recognition and key information extraction are achieved.
Patent Information
- Application Number
- CN202411797229.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-03-28
AI Technical Summary
Traditional text recognition methods are difficult to cope with complexity in power audit business, resulting in inefficient auditing and error-prone.
OCR technology is used to convert historical data into a digital sequence training set, and train it by building a BiLSTM model and setting an attention mechanism layer to capture the context information of the text and automatically pay attention to important information, realizing automatic text recognition and extraction of key information.
It improves the text recognition efficiency and accuracy of power audit services and provides efficient and accurate data support.
Smart Images

Figure CN119721026A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of text recognition, and in particular to a text recognition method and system for electric power auditing business. Background Art
[0002] In the power audit business, text recognition is an important link, which involves extracting key information from various power-related documents, such as project name, amount, time, etc. Traditional text recognition methods often rely on manual operations, which are difficult to cope with complex audit business, easily resulting in low audit efficiency and prone to errors. With the rapid development of artificial intelligence technology, especially the widespread application of deep learning technology, text recognition methods based on deep learning can often accurately identify valid information in text according to the context in complex power audit business, and can ignore redundant information, ensuring the efficiency and accuracy of text recognition. Summary of the invention
[0003] In order to overcome the above problems, the present invention provides a text recognition method and system for electric power audit business. The text recognition method first obtains and pre-processes historical data of the electric power audit business, and uses OCR technology to convert it to obtain a digital sequence training set, and evaluates and trains by setting a BiLSTM model and an attention mechanism layer. The trained BiLSTM model can process the input sequence from two directions (forward and backward) to capture richer contextual information of the electric power audit text. The BiLSTM model can effectively extract temporal features and semantic information in the text. The attention mechanism layer can enable the model to automatically focus on important information that is helpful for the recognition task when processing the input text, while ignoring irrelevant or redundant information, thereby realizing automatic recognition of the text and extraction of key information, and providing efficient and accurate data support for the electric power audit business.
[0004] In order to achieve the above object, the present invention provides a text recognition method for power audit business on one hand, the text recognition method includes:
[0005] Acquiring and preprocessing historical data of the power audit business;
[0006] Using OCR technology to convert the pre-processed historical data into a digital sequence training set;
[0007] A BiLSTM model is constructed using a deep learning framework, and an attention mechanism layer is set in the BiLSTM model;
[0008] The BiLSTM model is trained and evaluated using a digital sequence training set, and the parameters of the BiLSTM model are adjusted to control its loss function based on the reliability index of the text recognition of the BiLSTM model, so as to obtain the final BiLSTM model;
[0009] The final BiLSTM model is deployed in the power audit system to realize text recognition of the power audit business.
[0010] Preferably, the acquiring and preprocessing of the historical data of the power audit business includes:
[0011] The historical data is divided into image documents and text documents;
[0012] The image document is converted by using an image preprocessing method, and the text document is converted by using a text preprocessing method.
[0013] Preferably, a deep learning framework is used to construct a BiLSTM model, and an attention mechanism layer is set in the BiLSTM model, including:
[0014] The BiLSTM model is constructed, and the digital sequence training set is obtained as the first input of the BiLSTM model, and the first output of the BiLSTM model is obtained according to formula (1), and it is used as the third input of the attention mechanism layer, and the final output of the BiLSTM model is obtained according to formula (2).
[0015]
[0016]
[0017] in, is the hidden output state of the forward LSTM layer at time t, x t is the first input at time t, is the hidden output state of the forward LSTM layer at time t-1, is the hidden output state of the backward LSTM layer at time t, is the hidden output state of the backward LSTM layer at time t-1, h t is the first output of the BiLSTM model at time t and the third input of the attention mechanism layer, α t is the weight index of the attention mechanism layer at time t, w a is the weight matrix of the attention mechanism layer, b a is the bias term of the attention mechanism layer, s t is the final output of the BiLSTM model at time t.
[0018] Preferably, the BiLSTM model is trained and evaluated using a digital sequence training set, and the parameters of the BiLSTM model are adjusted based on the reliability index of the text recognition of the BiLSTM model to control its loss function to obtain the final BiLSTM model, including:
[0019] Obtain the digital sequence training set, and perform training evaluation on the BiLSTM model to obtain a final output;
[0020] The obtained final output is subjected to reliability index discrimination with the digital sequence training set to obtain a quantitative integral of the reliability index to determine the recognition effect of the BiLSTM model;
[0021] The quantified integral of the reliability index is compared with a preset threshold value. When the quantified integral is less than the threshold value, the parameters of the BiLSTM model are continuously iterated to obtain the BiLSTM model with the best loss function.
[0022] Preferably, the reliability indicators include accuracy, recall rate, and F1 value.
[0023] Preferably, the obtained final output is subjected to reliability index discrimination with the digital sequence training set to obtain a quantitative integral of the reliability index to determine the recognition effect of the BiLSTM model, including:
[0024] The final output is compared with the digital sequence training set to calculate the reliability index of accuracy, recall rate, and F1 value, and the first quantization integral, the second quantization integral, and the third quantization integral are obtained in sequence;
[0025] The first quantization integral, the second quantization integral, and the third quantization integral are weightedly calculated to obtain a final quantization integral for judging the recognition effect of the BiLSTM model, so as to determine the recognition effect of the BiLSTM model.
[0026] Preferably, the quantized integral of the reliability index is compared with a preset threshold, and when the quantized integral is less than the threshold, the parameters of the BiLSTM model are continuously iterated to obtain the BiLSTM model with the best loss function, including:
[0027] Define a loss function of the BiLSTM model, calculate a value of the loss function using current parameters of the BiLSTM model, and calculate a gradient of the loss function to the parameters of the BiLSTM model using a back propagation algorithm;
[0028] The parameters of the BiLSTM model are updated by using a stochastic gradient algorithm, and the reliability index is quantitatively integrated again after iterating the parameters. When the quantitative integral is less than the threshold, the BiLSTM model and its parameters with the best loss function are determined.
[0029] Preferably, the loss function is one of a cross entropy loss function and a mean square error loss function.
[0030] On the other hand, the present invention also provides a text recognition system for power auditing business, the text recognition system comprising:
[0031] A data preprocessing module, the data preprocessing module receives and preprocesses the historical data of the power audit business;
[0032] An OCR processing module, electrically connected to the data preprocessing module, and configured to convert the preprocessed historical data into a digital sequence training set;
[0033] A BiLSTM model processing module is electrically connected to the OCR processing module, and a BiLSTM model and an attention mechanism layer are arranged in the BiLSTM model processing module, so as to implement the text recognition method as described in any one of the above claims.
[0034] Through the above technical scheme, the text recognition method first obtains and pre-processes the historical data of the power audit business, and at the same time uses OCR technology to convert it to obtain a digital sequence training set, and evaluates and trains by setting a BiLSTM model and an attention mechanism layer. The trained BiLSTM model can process the input sequence from two directions (forward and backward), so as to capture richer context information of the power audit text. The BiLSTM model can effectively extract the temporal features and semantic information in the text. The attention mechanism layer can enable the model to automatically focus on important information that is helpful for the recognition task when processing the input text, while ignoring irrelevant or redundant information, so as to realize automatic recognition of the text and extraction of key information; at the same time, the reliable index is reasonably set, and the quantitative integral of the reliable index is used to ensure that the BiLSTM model meets the requirements for text processing. At the same time, under the condition that the quantitative integral meets the threshold, the parameters of the BiLSTM model are adjusted, and under the condition that the loss function is optimized, a reasonable and effective BiLSTM model is determined, and it is deployed in the power system to process the power audit business, so as to improve the efficiency of text recognition for processing the power audit business. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:
[0036] Figure 1 is a flow chart of a text recognition method for power auditing business according to an embodiment of the present invention;
[0037] Figure 2 It is a flowchart of training and evaluating BiLSTM model generation for a text recognition method for power auditing business according to an embodiment of the present invention. DETAILED DESCRIPTION
[0038] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.
[0039] like Figure 1 FIG. 1 is a flowchart of a text recognition method for power auditing business according to an embodiment of the present invention. Figure 1 In the text recognition method, the text recognition method may include:
[0040] In step S10, historical data of power audit business is acquired and preprocessed;
[0041] In step S11, the pre-processed historical data is converted into a digital sequence training set using OCR technology;
[0042] In step S12, a BiLSTM model is constructed using a deep learning framework, and an attention mechanism layer is set in the BiLSTM model;
[0043] In step S13, the BiLSTM model is trained and evaluated using a digital sequence training set, and the parameters of the BiLSTM model are adjusted based on the reliability index of the text recognition of the BiLSTM model to control its loss function, so as to obtain the final BiLSTM model;
[0044] In step S14, the final BiLSTM model is deployed in the power audit system to realize text recognition of the power audit business.
[0045] In such Figure 1In the method shown, step S10 is used to obtain and preprocess the historical data of the power audit business, remove useless data from the historical data, and classify the data, such as preprocessing the image data with deviation correction, denoising, and binarization, and preprocessing the text data with text cleaning, word segmentation, and stop word removal, to ensure the quality and accuracy of the data.
[0046] Step S11 is used to convert the pre-processed historical data into a digital sequence training set using OCR technology to ensure that the data can be converted into a digital sequence training set for model recognition.
[0047] Step S12 is used to construct a BiLSTM model using a deep learning framework, and set an attention mechanism layer in the BiLSTM model, so as to identify text information in the power business to be audited through the BiLSTM model and the attention mechanism layer, thereby ensuring that valid information is extracted while ignoring redundant and invalid information;
[0048] Step S13 is used to train and evaluate the BiLSTM model using the digital sequence training set, and adjust the parameters of the BiLSTM model to control the loss function according to the reliability index of the text recognition of the BiLSTM model, so that after the BiLSTM model is trained with the digital sequence training set, it can be judged according to the standard of the reliability index, and the parameters are continuously adjusted to control the loss function of the BiLSTM model to be stable and optimal, thereby adjusting the most suitable BiLSTM model;
[0049] Step S14 is used to deploy the adjusted final BiLSTM model in the power audit system to realize text recognition of the power audit business, thereby ensuring the normal audit of the power audit business and accurately extracting effective information.
[0050] The text recognition method of the above technical solution first obtains and preprocesses the historical data of the power audit business, and at the same time uses OCR technology to convert it to obtain a digital sequence training set, and evaluates and trains it by setting a BiLSTM model and an attention mechanism layer. The trained BiLSTM model can process the input sequence from two directions (forward and backward), thereby capturing richer contextual information of the power audit text. The BiLSTM model can effectively extract the temporal features and semantic information in the text. The attention mechanism layer enables the model to automatically focus on important information that is helpful for the recognition task when processing the input text, while ignoring irrelevant or redundant information, thereby realizing automatic recognition of the text and extraction of key information, and providing efficient and accurate data support for the power audit business.
[0051] Taking into account that the historical data of different types of power audit business need to be classified and preprocessed, therefore, in one embodiment of the present invention, when obtaining the historical data of the power audit business, it is necessary to divide the historical data into image documents and text documents, and use an image preprocessing method to convert the image documents, and use a text preprocessing method to convert the text documents. The image documents can be preprocessed by correction, denoising, binarization, etc., and the text data can be preprocessed by text cleaning, word segmentation, stop word removal, etc. to ensure the quality and accuracy of the data.
[0052] In order to facilitate text recognition of processed data, a deep learning framework is used to build a BiLSTM model that can be used to effectively extract data. At the same time, an attention mechanism layer is set in the BiLSTM model to improve the efficiency of rapid extraction of important information related to the context of the entire text.
[0053] First, a BiLSTM model is constructed, and a digital sequence training set is obtained as the first input of the BiLSTM model. The first output of the BiLSTM model is obtained according to formula (1), and it is used as the third input of the attention mechanism layer. The final output of the BiLSTM model is obtained according to formula (2).
[0054]
[0055]
[0056] in, is the hidden output state of the forward LSTM layer at time t, x t is the first input at time t, is the hidden output state of the forward LSTM layer at time t-1, is the hidden output state of the backward LSTM layer at time t, is the hidden output state of the backward LSTM layer at time t-1, h t is the first output of the BiLSTM model at time t and the third input of the attention mechanism layer, α t is the weight index of the attention mechanism layer at time t, w a is the weight matrix of the attention mechanism layer, b a is the bias term of the attention mechanism layer, s t is the final output of the BiLSTM model at time t.
[0057] like Figure 2 The figure is a flowchart of the training and evaluation BiLSTM model generation of a text recognition method for power audit business according to one embodiment of the present invention. Figure 2In order to improve the training effect of the BiLSTM model, it is ensured that it can perform reasonable and effective text recognition and extraction within a set range, and the training of the model is effective; in one embodiment of the present invention, a digital sequence training set can be used to train and evaluate the BiLSTM model, and the parameters of the BiLSTM model are adjusted according to the reliable index of the text recognition of the BiLSTM model to control the numerical value of the loss function; therefore, in the following steps, step S20 first obtains the digital sequence training set, and trains and evaluates the BiLSTM model to obtain the final output; step S21 performs reliable index discrimination on the final output obtained with the digital sequence training set to obtain the quantitative integral of the reliable index to determine the recognition effect of the BiLSTM model; step S22 compares the quantitative integral of the reliable index with a preset threshold, and when the quantitative integral is less than the threshold, continuously iterates the parameters of the BiLSTM model to obtain the BiLSTM model with the best loss function.
[0058] Considering the influence of different reliability indicators on the evaluation of recognition effect, in order to ensure the recognition effect, in one embodiment of the present invention, the reliability indicators include accuracy, recall rate, and F1 value. The joint effect of multiple reliability indicators can improve the effect of text recognition.
[0059] In view of the role of multiple reliable indicators, it is ensured that the BiLSTM model can adjust parameters to control the loss function by quantifying the reliable indicators, thereby ensuring the rationality and reliability of the BiLSTM model. In one embodiment of the present invention, the final output obtained is compared with the digital sequence training set for reliable indicator discrimination to obtain the quantified integral of the reliable indicators to determine the recognition effect of the BiLSTM model; therefore, in the following steps, the final output is compared with the digital sequence training set for reliable indicator calculation of accuracy, recall rate, and F1 value to obtain the first quantized integral, the second quantized integral, and the third quantized integral in turn; the first quantized integral, the second quantized integral, and the third quantized integral are weightedly calculated to obtain the final quantized integral for judging the recognition effect of the BiLSTM model to determine the recognition effect of the BiLSTM model. At the same time, for the parameter adjustment of the BiLSTM model, it is necessary to consider control based on the loss function within a reasonable threshold of quantitative integration; in one embodiment of the present invention, the loss function of the BiLSTM model is first defined, the value of the loss function is calculated using the current parameters of the BiLSTM model, and the parameter gradient of the loss function to the BiLSTM model is calculated using the back propagation algorithm; the parameters of the BiLSTM model are updated using the stochastic gradient algorithm, and the quantitative integration of the reliability indicators is performed again after iterating the parameters. When the quantitative integration is less than the threshold, the BiLSTM model and its parameters with the smallest loss function are determined, thereby determining a BiLSTM model that can meet the operation requirements of the power audit business.
[0060] Taking into account the impact of the loss function on the parameter adjustment of the BiLSTM model, the loss function is determined based on the historical data of the power audit business. In one embodiment of the present invention, the loss function is one of the cross entropy loss function and the mean square error loss function. Different loss functions can be called and used according to the classification of the data.
[0061] The second aspect of the present invention provides a text recognition system for power auditing business. The text recognition system includes a data preprocessing module, an OCR processing module and a BiLSTM model processing module. The data preprocessing module receives and preprocesses historical data of the power auditing business. The OCR processing module is electrically connected to the data preprocessing module. The OCR processing module is used to convert the preprocessed historical data into a digital sequence training set; the BiLSTM model processing module is electrically connected to the OCR processing module. The BiLSTM model processing module is provided with a BiLSTM model and an attention mechanism layer, which are used for training and evaluation with the digital sequence training set, and for implementing any of the text recognition methods described above.
[0062] Through the above technical scheme, the text recognition method first obtains and preprocesses the historical data of the power audit business, and at the same time uses the OCR technology to convert it to obtain a digital sequence training set, and evaluates and trains by setting a BiLSTM model and an attention mechanism layer. The trained BiLSTM model can process the input sequence from two directions (forward and reverse), thereby capturing richer context information of the power audit text. The BiLSTM model can effectively extract the temporal features and semantic information in the text. The attention mechanism layer enables the model to automatically focus on important information that is helpful for the recognition task when processing the input text, while ignoring irrelevant or redundant information, thereby realizing automatic recognition of the text and extraction of key information; at the same time, a reasonable reliability index is set, and the quantitative integral of the reliability index is used to ensure that the BiLSTM model meets the requirements for text processing. At the same time, under the condition that the quantitative integral meets the threshold, the parameters of the BiLSTM model are adjusted, and under the condition that the loss function is optimized, a reasonable and effective BiLSTM model is determined, and it is deployed in the power system to process the power audit business, thereby improving the efficiency of text recognition for processing the power audit business.
[0063] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0064] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A text recognition method for power auditing business, characterized in that: The text recognition method comprises: Acquiring and preprocessing historical data of the power audit business; Using OCR technology to convert the pre-processed historical data into a digital sequence training set; A BiLSTM model is constructed using a deep learning framework, and an attention mechanism layer is set in the BiLSTM model; The BiLSTM model is trained and evaluated using a digital sequence training set, and the parameters of the BiLSTM model are adjusted to control its loss function based on the reliability index of the text recognition of the BiLSTM model, so as to obtain the final BiLSTM model; The final BiLSTM model is deployed in the power audit system to realize text recognition of the power audit business.
2. The text recognition method according to claim 1, characterized in that: The obtaining and preprocessing of the historical data of the power audit business includes: The historical data is divided into image documents and text documents; The image document is converted by using an image preprocessing method, and the text document is converted by using a text preprocessing method.
3. The text recognition method according to claim 1, characterized in that: A BiLSTM model is constructed using a deep learning framework, and an attention mechanism layer is set in the BiLSTM model, including: The BiLSTM model is constructed, and the digital sequence training set is obtained as the first input of the BiLSTM model, and the first output of the BiLSTM model is obtained according to formula (1), and it is used as the third input of the attention mechanism layer, and the final output of the BiLSTM model is obtained according to formula (2). in, is the hidden output state of the forward LSTM layer at time t, x t is the first input at time t, is the hidden output state of the forward LSTM layer at time t-1, is the hidden output state of the backward LSTM layer at time t, is the hidden output state of the backward LSTM layer at time t-1, h t is the first output of the BiLSTM model at time t and the third input of the attention mechanism layer, a t is the weight index of the attention mechanism layer at time t, w a is the weight matrix of the attention mechanism layer, b a is the bias term of the attention mechanism layer, s t is the final output of the BiLSTM model at time t.
4. The text recognition method according to claim 1, characterized in that: The BiLSTM model is trained and evaluated using a digital sequence training set, and the parameters of the BiLSTM model are adjusted based on the reliability index of the text recognition of the BiLSTM model to control its loss function to obtain the final BiLSTM model, including: Obtain the digital sequence training set, and perform training evaluation on the BiLSTM model to obtain a final output; The obtained final output is subjected to reliability index discrimination with the digital sequence training set to obtain a quantitative integral of the reliability index to determine the recognition effect of the BiLSTM model; The quantified integral of the reliability index is compared with a preset threshold value. When the quantified integral is less than the threshold value, the parameters of the BiLSTM model are continuously iterated to obtain the BiLSTM model with the best loss function.
5. The text recognition method according to claim 4, characterized in that: The reliability indicators include accuracy, recall rate, and F1 value.
6. The text recognition method according to claim 5, characterized in that: The obtained final output is subjected to reliability index discrimination with the digital sequence training set to obtain a quantitative integral of the reliability index to determine the recognition effect of the BiLSTM model, including: The final output is compared with the digital sequence training set to calculate the reliability index of accuracy, recall rate, and F1 value, and the first quantization integral, the second quantization integral, and the third quantization integral are obtained in sequence; The first quantization integral, the second quantization integral, and the third quantization integral are weightedly calculated to obtain a final quantization integral for judging the recognition effect of the BiLSTM model, so as to determine the recognition effect of the BiLSTM model.
7. The text recognition method according to claim 4, characterized in that: According to the quantized integral of the reliability index, the quantized integral is compared with a preset threshold value, and when the quantized integral is less than the threshold value, the parameters of the BiLSTM model are continuously iterated to obtain the BiLSTM model with the best loss function, including: Define a loss function of the BiLSTM model, use the current parameters of the BiLSTM model to calculate the value of the loss function, and use a back propagation algorithm to calculate the gradient of the loss function with respect to the parameters of the BiLSTM model; The parameters of the BiLSTM model are updated by using a stochastic gradient algorithm, and the reliability index is quantitatively integrated again after iterating the parameters. When the quantitative integral is less than the threshold, the BiLSTM model and its parameters with the best loss function are determined.
8. The text recognition method according to claim 7, characterized in that: The loss function is one of a cross entropy loss function and a mean square error loss function.
9. A text recognition system for power auditing business, characterized in that: The text recognition system comprises: A data preprocessing module, the data preprocessing module receives and preprocesses the historical data of the power audit business; An OCR processing module, electrically connected to the data preprocessing module, and configured to convert the preprocessed historical data into a digital sequence training set; A BiLSTM model processing module is electrically connected to the OCR processing module, and a BiLSTM model and an attention mechanism layer are provided in the BiLSTM model processing module, so as to implement the text recognition method as described in any one of claims 1 to 8.
Citation Information
Cited By
Ecological environment administrative penalty file evaluation method and system
CN121169294A
An ecological environment administrative punishment case file evaluation method and system
CN121169294B