OCR (Optical Character Recognition) method for production logging-oriented archival data
The OCR recognition method that combines DBNet and CRNN models solves the problem of complex image recognition of production logging archives, improves the efficiency and accuracy of automated processing, and overcomes the problems of low manual operation efficiency and paper file corruption.
Patent Information
- Application Number
- CN202410712820.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-09-03
AI Technical Summary
Existing production logging archive data processing relies on manual operations, which is inefficient and paper archive data is easily corrupted. It is difficult for traditional OCR recognition methods to accurately identify complex production logging archive data images and text.
Using the text detection model based on DBNet and the text recognition model based on CRNN, through data preprocessing, model training and verification, combined with grayscale, binarization and image tilt correction technology, an OCR recognition method for production logging archive data was constructed. .
It improves the automated processing level and data analysis efficiency of production logging archive data, enhances the accuracy of text detection and recognition, and solves the problems of low manual processing efficiency and paper file corruption.
Smart Images

Figure CN118587719A
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of production logging archive data processing, and in particular to an OCR recognition method for archive data of production logging. Background Art
[0002] As the archival materials were previously preserved in paper form, and paper always rots and breaks over time, the characters in the paper materials also suffer from this damage, resulting in a large number of important archival materials being unable to be preserved intact. Therefore, it is particularly important to effectively preserve paper archival materials. The traditional production logging archival material processing method still follows the labor-intensive manual operation mode, especially when transcribing and organizing production logging archival material information, the staff needs to review the paper documents or electronic original materials one by one, and manually transcribe or input them into the electronic system. This process is time-consuming and labor-intensive, and the work efficiency is greatly limited. The digital processing method of production logging archival materials relying on manpower has exposed obvious shortcomings. With the practice of computer technology in life, paper archival materials can be saved as electronic archival materials with the help of optical character recognition (OCR).
[0003] With the continuous development of digital technology, the clever use of OCR recognition methods based on deep learning provides an excellent research direction for the storage of production logging archival data. The automated processing of production logging archival data conforms to the requirements of modern society for fast and accurate acquisition and analysis of logging data, which is beneficial to promoting the informatization construction and modernization process of the entire logging industry, improving the digital conversion rate and overall management level of production logging archival data, and exploring how to successfully apply advanced optical character recognition (OCR) technology to the digital recognition process of archival data in the field of production logging and improve the automated processing level and data analysis efficiency of production logging archival data are both discussion focuses that are worth exploring.
[0004] OCR recognition method is a relatively mature technology in the field of image recognition. The OCR recognition method based on deep learning has powerful image recognition capabilities. OCR recognition includes text detection and text recognition. However, considering that the archival image data for production logging will have different complex recognition scenarios due to different environments, it cannot adapt to the production logging archival image. The deep learning model is combined to deal with the complex problems of traditional production logging. The characteristics of production logging archival data include tables and texts. OCR recognition of production logging archival texts includes text detection and text recognition. The traditional OCR recognition methods and tools cannot accurately recognize the text of production logging archival images. Therefore, this paper selects DBNet network as the text detection model. First, through the backbone network deep residual network, the trained vector is input into the feature pyramid network to obtain the feature map, and then the probability map and threshold map are constructed to derive the approximate binary image for prediction; CRNN network is selected as the text recognition model. First, the convolutional neural network of the convolutional layer is used to extract the feature map. Next, each feature vector in the bidirectional long short-term memory network in the cyclic layer is calculated, and the feature sequence is predicted based on this. Finally, according to the loss function, the label sequence obtained by the cyclic layer is converted into the final label sequence.
[0005] This paper combines the existing network models and the characteristics of production logging archival data to build a text detection model based on the DBNet network and a text recognition model based on the CRNN network, so as to achieve the purpose of studying the OCR recognition method of production logging archival data. Summary of the invention
[0006] The purpose of the present invention is to provide an OCR recognition method for production logging archival data, and the device is used to work, thereby solving the problems of low efficiency of existing production logging archival data relying on manual processing and corruption of paper archival data.
[0007] To achieve the above object, the present invention provides the following technical solution: an OCR recognition method for archival data of production logging, including a DBNet-based text detection method and a CRNN-based text recognition method, wherein the text detection method includes the following steps:
[0008] S1: Data preprocessing: By participating in a project development of a petroleum company in Daqing, we collected production logging archive data sets, including original production logging maps, injection profile logging geological design, and perforation depth notices. We preprocessed the collected production logging archive data images and data, including grayscale, binarization, and image tilt correction of the data sets;
[0009] S2: Dataset division: The preprocessed dataset is divided into three subsets: training set, validation set and test set. The training set is used for model training, the validation set is used for error calculation and parameter adjustment during model training, and the test set is used to evaluate the performance of the model.
[0010] S3: Model building and training: Build a DBNet model for text detection, train the model using the training set, and use the validation set to evaluate the model performance and make adjustments to achieve better text detection results;
[0011] S4: Model verification and evaluation: After the model training is completed, the model is finally verified and evaluated using the test set. The performance indicators of the model on the test set are calculated to evaluate the performance of the model in practical applications. The text detection effect of the model can be further verified by visualizing the results or manually checking them.
[0012] S5: Apply the model: Use the trained DBNet model to perform text detection on production logging archive data. Input the image to be detected into the model, and the model will output the location and size information of the text area in the image. Based on this information, the text can be further recognized and processed.
[0013] The text recognition method includes the following steps:
[0014] S1: Data preprocessing: Similar to S1 in the text detection method, the original image is converted into a grayscale image, the color information is removed, and then binarization is performed to convert the image into a simple black and white binary image. Next, the tilted image is corrected to make it horizontal;
[0015] S2: Dataset division: Similar to S2 in the text detection method, the preprocessed dataset is divided into training set, validation set and test set for model training, validation and evaluation;
[0016] S3: Model training: Build a text recognition CRNN network model and train it using the training set. By inputting the training set images and corresponding labels, the model parameters are updated using the error calculation and back propagation methods to improve the accuracy of the model in text recognition.
[0017] S4: Model verification: Use the test set to verify the trained CRNN model, input the test set images into the model, compare the text results output by the model with the true labels, and evaluate the performance of the model in text recognition. Indicators such as accuracy and edit distance can be used for evaluation to determine the accuracy and robustness of the model.
[0018] S5: Application model: Use the trained CRNN model to perform text recognition on production logging archive data, input the image to be recognized into the model, and the model will output the recognition result.
[0019] Furthermore, S1 in the text detection method comprises the following steps:
[0020] S101: Grayscale conversion: Convert the color image of production logging archive data into a grayscale image, that is, convert the information of various colors in the image into grayscale values, so that the image only contains grayscale information and no longer has color information. The grayscale value of each pixel in the grayscale image is usually between 0 and 255, indicating different grayscale levels from black to white. These methods cover a variety of strategies such as component method, maximum value method, average method and weighted average method to reduce the amount of calculation while retaining the key information of the image and simplifying the processing process. Based on the characteristics of production logging archive data, the grayscale weighted average method is used, as shown in the following formula:
[0021] F(i,j)=0.2989R(i,j)+0.5370G(i,j)+0.1140B(i,j)
[0022] S102: Binarization: Image binarization converts a complex grayscale or color image into a simple binary image. It converts a grayscale image or a color image into an image type containing only two grayscale levels, usually black and white, which is usually called a binary image. Binarization methods include simple threshold method, mean method, Gaussian method and Otsu's method. In combination with the characteristics of the production logging archive data set, Otsu's method is used to make the production logging archive data set transition from grayscale to binary.
[0023] S103: Image tilt correction: Image tilt correction is to solve the tilt problem caused by shooting angle or other reasons, and convert the tilted image into a horizontal image. Correcting the tilted image is the third step of preprocessing for identifying logging data. It is a necessary step before identifying logging data. This preprocessing step will improve the efficiency of identifying logging data and the visibility of the image. The implementation principle is to convert the image origin and the Cartesian coordinate origin. First, the origin in the upper left corner needs to be transferred to the center of the image, and then a specified angle is selected for selection. Finally, the coordinates are transferred from the center origin to the upper left corner. For tilted images, the tilted text in the image is detected and corrected, so that the text area is arranged horizontally or vertically, ensuring that the text is placed horizontally, and improving the accuracy of text detection.
[0024] Furthermore, S2 in the text detection method comprises the following steps:
[0025] S201: Training set: The training set is used for the training process of the model by learning the parameters of the mapping from the input image to the output text area. The data volume of the specific training set contains most of the data in the dataset, but the volume ratio depends on the size of the dataset and the available computing resources.
[0026] Furthermore, S2 in the text detection method comprises the following steps:
[0027] S202: Validation set: The validation set is used to evaluate the performance of the model during the model training process and adjust the parameters or hyperparameters of the model based on the evaluation results. The main purpose of the validation set is to prevent overfitting and ensure that the model has good generalization ability on unseen data. The amount of data in the validation set is usually smaller than that in the training set to ensure reliable performance evaluation. The common division ratio is 70% for the training set and 15% for the validation set.
[0028] Furthermore, S2 in the text detection method comprises the following steps:
[0029] S203: The test set is used to evaluate the final performance of the model after the model training is completed. The test set provides an independent and fair evaluation standard to determine whether the model has truly learned to extract text areas from the input image. The amount of data in the test set is usually smaller than that in the training set to provide an independent and fair evaluation standard. The common division ratio is 70% for the training set, 15% for the validation set, and 15% for the test set.
[0030] Furthermore, S3 in the text detection method comprises the following steps:
[0031] S301: Build the model: Select DBNet as the text detection model and build the corresponding network structure. DBNet is a segmentation-based text detection method that can effectively detect text areas in images. When building the model, you need to define the network's hierarchy, activation function, loss function, etc., and initialize the model's parameters.
[0032] Furthermore, S3 in the text detection method comprises the following steps:
[0033] S302: Model training: Use the training set to train the DBNet model. During the training process, the parameters of the model are continuously updated through the back propagation algorithm and the gradient descent optimizer to minimize the error between the predicted results and the true labels. The images in the training set will be input into the model, and the model will make predictions based on the current parameters. Then, the error between the predicted results and the labels is calculated, and the parameters are updated through the optimizer.
[0034] Furthermore, S3 in the text detection method comprises the following steps:
[0035] S303: Verification and adjustment: During the training process, the model is verified using the validation set. The performance of the model is evaluated by calculating the performance indicators of the model on the validation set, such as accuracy, recall, F1 score, etc. Based on the verification results, the model's hyperparameters such as learning rate, batch size, etc. or the network structure can be adjusted to optimize the model's performance. This process usually includes multiple iterations of training and verification until satisfactory performance is achieved.
[0036] Furthermore, the text recognition method S3 comprises the following steps:
[0037] S301: Build a CRNN text recognition model. The CRNN model combines the advantages of convolutional neural network (CNN) and recurrent neural network (RNN), and can simultaneously process the sequence information and spatial information of the image.
[0038] Furthermore, the text recognition method S3 comprises the following steps:
[0039] S302: Use the training set to train the CRNN model. During the training process, use the validation set to perform error calculation and model parameter update to optimize the performance of the model.
[0040] Compared with the prior art, the present invention has the following beneficial effects:
[0041] The present invention proposes an OCR recognition method for archival data of production logging. The existing production logging archival data relies on manual processing with low efficiency and paper archival data corruption problem. The text detection method DBNet of the present invention adopts the backbone network ResNet18 combined with the residual connection mechanism, which effectively addresses the gradient vanishing and explosion problems commonly existing in deep neural networks, thereby supporting the construction of a deeper network structure. The feature extraction model FPN can make predictions on feature maps of different scales, so that it can better process target features of different sizes, thereby improving the accuracy and robustness of target detection. The text recognition method CRNN feature extraction model BiLSTM can improve the sensitivity and modeling efficiency of the entire sequence context relationship. The CTC loss function calculates the posterior probability of the output label sequence probability with the purpose of removing repeated redundant information, thereby improving the recognition effect.
[0042] The method proposed in this paper performs well in identifying production logging archival data. Experimental results show that the method proposed in this paper helps to extract image features of production logging archival data and accurately identify production logging archival data. Moreover, this method can greatly enhance the model's ability to identify production logging archival data, and provides an identification idea for identifying production logging archival data. This shows that this method has great potential in the process of digital transformation of production logging archival data, and can improve efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 This is a structural diagram of the backbone network ResNet50 of the text detection method DBNet of the present invention;
[0044] Figure 2 It is a feature extraction FPN structure diagram of the text detection method DBNet of the present invention;
[0045] Figure 3 It is a structural diagram of the backbone network CNN of the text recognition method CRNN of the present invention;
[0046] Figure 4 This is a structural diagram of the backbone network BiLSTM of the text recognition method CRNN of the present invention;
[0047] Figure 5 It is a flow chart of the OCR preprocessing method of the present invention;
[0048] Figure 6 This is a flow chart of DBNet training of text detection method in Example 1;
[0049] Figure 7 CRNN training flow chart of the text recognition method in Example 1. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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 are within the scope of protection of the present invention.
[0051] In order to further understand the content of the present invention, the present invention is described in detail in conjunction with the accompanying drawings.
[0052] The present invention will be further described below in conjunction with the embodiments.
[0053] Example 1
[0054] See also Figure 1As shown in the figure, the ResNet50 network architecture is developed on the basis of the ResNet series. It contains a total of 49 convolutional layers and an additional fully connected layer. The structure of ResNet50 is subdivided into seven different modules: the initial part does not have a residual block structure, which is mainly responsible for the initial convolution processing, regularization, activation function and maximum pooling operation of the input image. The next four modules are equipped with residual blocks. Each residual block inputs the output of the previous layer, and then passes through 1 layer of 1×1 convolution, 1 layer of 3×3 convolution and 1 layer of 1×1 convolution. The first and second layers of convolution in each residual block are the same size, and the third layer of convolution dimension is twice the size of the first two layers. Figure 1 It can be seen that the Resnet50 network has a total of 1+3×(3+4+6+3)=49 convolutional layers. Together with the last fully connected layer, the total number of layers reaches 50. When the input image size is 3×224×224, the dimension of the convolutional layer in the first part is 64×112×112, and after maximum pooling, it is 64×56×56; the three convolutions of the first layer of Bottle Neck in the second part are 64×56×56, 64×56×56, and 256×56×56 respectively; the three convolutions of the second layer of Bottle Neck in the second part are consistent with the three convolutions of the first layer of Bottle Neck in the second part; the three convolutions of the first layer of Bottle Neck in the third part are 128×56×56, 128×28×28, and 512×28×28 respectively; the second layer of Bottle Neck in the third part is 128×56×56, 128×28×28, and 512×28×28 respectively. The three convolution layers of Neck are 128×28×28, 128×28×28 and 512×28×28 respectively; similar to the third part, each part will have three convolution layers of different dimensions, and the convolution size of the fourth part changes to 256×28×28, 256×14×14 and 1024×14×14; the convolution size of the fifth part changes to 256×14×14, 512×7×7 and 2048×7×7, and the sixth and seventh parts are the average pooling layer Avg Pool and the fully connected layer FC respectively.
[0055] See also Figure 2 As shown in the figure, FPN fuses features of different scales to achieve accurate detection of multi-scale targets. It has two characteristics: multi-scale feature fusion technology and hierarchical processing strategy are used to divide the target detection task into multiple subdivision detection tasks according to the size difference of the object, so as to enhance the diversity and integrity of feature representation. Its structure is as follows Figure 2 As shown in Figure 1, the information transmission includes bottom-up, top-down and horizontal transmission. First, the information transmission is divided into four stages, which are 1 / 4, 1 / 8, 1 / 16 and 1 / 32 of the original image size. Figure 2In the figure, they are denoted as C2, C3, C4 and C5, with dimensions of 160×160×64, 80×80×128, 40×40×256 and 20×20×512, respectively. They all pass through a layer of Conv with a convolution kernel of 1×1. The number of channels of the four layers of information is set to 64. The Conv in the upper layer, that is, the non-bottommost Conv, is Upsampled and concat-merged with the next layer next to it. If it is not the bottommost layer, its value is passed downward again. The C4 feature map (1 / 16) is added to the C5 feature map (1 / 32) by twice the upsampling to obtain a new 1 / 16 feature map; the C3 feature map (1 / 8) is added to the C4 feature map (1 / 16) by twice the upsampling to obtain a new 1 / 8 feature map; the C2 feature map (1 / 4) is added to the C3 feature map (1 / 8) by twice the upsampling to obtain a new 1 / 4 feature map. After each layer is concat-operated, it continues to go through a layer of Conv with a convolution kernel of 3×3, and the dimension size remains unchanged. C5 performs Conv and 8-fold upsampling, C4 performs Conv and 4-fold upsampling, C3 performs Conv and 2-fold upsampling, and C2 performs Conv. The four feature maps are upsampled to 1 / 4 of the original image respectively. Finally, the four 1 / 4-sized feature maps of C2, C3, C4 and C5 are merged and concat-ed to obtain the final feature of 160×160×64.
[0056] DBHead is the third part of DBNet. Given the top feature map F generated by FPN as input, a probability map (P) and a threshold map (T) are generated in the process, and finally an approximate binary output image (approximate binary map) is obtained through calculation. The size of the F feature map is set to F (batch, chanel, width, high), where batch is the size of each batch of input vectors, chanel is the number of channels, width and high are the width and height of the feature map respectively. The process of generating P from F is:
[0057] Process 1: The feature map size of F is (n, 256, 1 / 4W, 1 / 4H), where n is the size of each batch of input vectors. F first passes through the convolution layer to compress the chanel to 1 / 4 of the input, and then passes through batch normalization BN and activation function relu, and the resulting feature map size is (batch, 64, 1 / 4W, 1 / 4H);
[0058] Process 2: Deconvolution operation is performed on the obtained feature map, the convolution kernel is (2,2), and the dimension size of the obtained feature map is (n, 256, 1 / 2W, 1 / 2H). It can be seen that the feature map is 1 / 2 of the original image at this time;
[0059] Process three: Perform deconvolution operation again, which is the same as the second step, except that the output feature map chanel is set to 1, and the dimension size of the obtained feature map is (n, W, H), which is the size of the original image.
[0060] Process 4: Finally, after the activation function sigmoid, the probability map (P) is output.
[0061] After the probability map is generated, the calculation is performed to generate T from F. Consistent with the traditional segmentation method, a fixed threshold needs to be set to convert the probability map generated by the segmentation network into a binary image. Compared with the traditional method, DBNet requires an adaptive threshold. Through a similar acquisition operation, it outputs a threshold map T through a sigmoid activation function with a dimension size of (n, 1, W, H).
[0062] Using P and T, a differentiable binarization technique is applied to seamlessly integrate the binarization step into the training loop of the segmentation model, so that the approximate binarymap close to the binary form can be jointly optimized and effectively derived. The dimension size is (n, 3, W, H). The differentiable binarization principle is as follows.
[0063]
[0064] Among them, B is the generated approximate binary map, Pi,j is the probability map, Ti,j is the threshold map, and k is the magnification factor.
[0065] The CRNN network is applied in the text recognition task, including convolutional layer, recurrent layer and transcription layer. The convolutional neural network CNN is used for feature extraction, the bidirectional long short-term memory network BiLSTM is used to enhance the understanding and modeling of the internal context information of the sequence, and the connection time series classification algorithm CTC is used for sequence labeling and decoding output.
[0066] See also Figure 3 As shown in Figure 1, the CNN structure consists of 7 progressively deeper convolutional layers (Convolution, Conv), which are interspersed with 4 maximum pooling layers (Max-Pooling) and 2 batch normalization (Batch Normalization, BN) to optimize network performance. The order is as follows Figure 3As shown in the figure, the order is input layer, Conv, Max-Pooling, BN, Conv, BN, Conv, Max-Pooling, Conv, Conv, Max-Pooling, Conv, Max-Pooling, Conv, and output layer. In the 7 Conv layers, the step size is 1, the convolution kernel size of the last layer is 2×2, and the sizes of the other convolution kernels are 3×3. The number of channels of the seven Conv layers increases exponentially, from the initial 64 all the way to 512, and during this period, it has experienced 128, 256, 256, and twice 512. Among the 4 Max-Poolings, the first two Max-Poolings are of size 2×2, and the last two Max-Poolings are of size 1x2, which will produce a longer feature sequence. The input image data size is (height, width, channel), and the input data size is (32, 60, 1). It can be seen that the image is single-channel, the height is fixed to 32, and the width can be other values, but the data image needs to be unified. The output image size is (1, 40, 512), and 512 feature maps are obtained, with a height of 1 and a width of 40. CNN outputs the feature map, and then the feature vectors output by CNN from left to right need to be extracted to form a feature sequence. Each column contains 512-dimensional features, so that the i-th feature vector connects all the pixels in the i-th column of the feature map.
[0067] See also Figure 4 As shown in Figure 1, the bidirectional long short-term memory network (Bidirectional LSTM, BiLSTM) captures the bidirectional feature sequence of the image, combines the forward and backward LSTM into a bidirectional LSTM, and realizes long-distance and deep structural information, such as Figure 4As shown in the figure, the input feature sequence is X = [X1, X2, X3, …, Xn], and the output prediction distribution is Y = [Y1, Y2, Y3, …, Yn]. BiLSTM uses two layers of LSTM network with different directions and the same hidden layer. The specific implementation principle of LSTM is shown in the formula. Each part inputs xi and outputs yi. The intermediate state is hi. The nonlinear function used in the intermediate state is hi = g(xi, hi-1). The internal state hi is based on xi, and the output yi is based on hi. Based on the above content, the output yi is predicted. Before outputting yi, the label with the highest probability is obtained through softmax. This label is the predicted value of BiLSTM. The image size output by the CNN network is (1, 40, 512), so the maximum time length T of BiLSTM is 25. For each vector xi in the input sequence, its length is set to 512. The model sends a feature vector in each time step for classification tasks. The two LSTMs in opposite directions are distributed in this way. LSTM solves the gradient vanishing problem of RNN. LSTM maintains one direction and learns context information based on past vectors. BiLSTM integrates two LSTM units in opposite directions. By selectively forgetting the existing information in the vector and absorbing new information in a timely manner, it can effectively transmit information content that is beneficial to subsequent calculations during the advancement of the time step, while discarding unnecessary information fragments. At each time step, BiLSTM will output its hidden state, which enhances the ability to capture context information in the sequence. The two LSTMs in opposite directions complement each other, deepen the learning depth, and significantly improve performance.
[0068] In the third level of the model, namely the transcription layer, the prediction results made by BiLSTM for each feature vector will be converted into a target label sequence according to the highest probability combination principle. The label sequence output by BiLSTM inevitably contains redundant information, which affects the final recognition result. The CTC network adopts certain rules to eliminate repeated redundant information based on the relationship between effective information and blank information of the image information, and can output effective recognition results. The loss function of the CTC network follows Bi LSTM, calculates the input x through the alignment rule, and infers the posterior generalization p(y|x) of the output corresponding to y. The input vector x=[x1,x2,x3,…,xN], x passes through Bi LSTM output z=[z1,z2,z3,…,zN], and each component zi selects an element to form an output path, denoted as l. For the output label y corresponding to the input x, the estimation process of its posterior probability involves the cumulative summation of all possible path probabilities. At the same time, the posterior probability of a single path relative to the input x is obtained by multiplying the probability of each information element in the path. According to the CTC principle, we know that we may encounter continuous repeated characters and placeholders during the processing process, which means that for each output y, there may be multiple different paths corresponding to it. The posterior generalization p(y|x) of the input x corresponding to y is shown in the formula.
[0069]
[0070] Assuming that the output variables at different times are independent of each other, the posterior probability of the output path l to x is expressed as follows.
[0071]
[0072] Among them, lt represents the output information corresponding to path l at time t, and z represents the probability of selecting the output information as lt at time t. Therefore, combining the above two formulas, we can get the following formula.
[0073]
[0074] See also Figure 5-Figure 7 As shown, S1 in the text detection method includes the following steps: S1: data preprocessing: by participating in a project development of a petroleum company in Daqing, a data set of production logging archive data is collected, including original logging images of production logging, geological design of injection profile logging and perforation depth notice, and the collected production logging archive data images and data are preprocessed, including graying, binarization and image tilt correction of the data set;
[0075] S101: Grayscale conversion: Convert the color image of production logging archive data into a grayscale image, that is, convert the information of various colors in the image into grayscale values, so that the image only contains grayscale information and no longer has color information. The grayscale value of each pixel in the grayscale image is usually between 0 and 255, indicating different grayscale levels from black to white. These methods cover a variety of strategies such as component method, maximum value method, average method and weighted average method to reduce the amount of calculation while retaining the key information of the image and simplifying the processing process. Based on the characteristics of production logging archive data, the grayscale weighted average method is adopted, as shown in the following formula:
[0076] F(i,j)=0.2989R(i,j)+0.5370G(i,j)+0.1140B(i,j)
[0077] S102: Binarization: Image binarization converts a complex grayscale or color image into a simple binary image. It converts a grayscale image or a color image into an image type containing only two grayscale levels, usually black and white, which is usually called a binary image. Binarization methods include simple threshold method, mean method, Gaussian method and Otsu's method. In combination with the characteristics of the production logging archive data set, Otsu's method is used to make the production logging archive data set transition from grayscale to binary.
[0078] S103: Image tilt correction: Image tilt correction is to solve the tilt problem caused by shooting angle or other reasons, and convert the tilted image into a horizontal image. Correcting the tilted image is the third step of preprocessing for identifying logging data. It is a necessary step before identifying logging data. This preprocessing step will improve the efficiency of identifying logging data and the visibility of the image. The implementation principle is to convert the image origin and the Cartesian coordinate origin. First, the origin in the upper left corner needs to be transferred to the center of the image, and then a specified angle is selected for selection. Finally, the coordinates are transferred from the center origin to the upper left corner. For tilted images, the tilted text in the image is detected and corrected, so that the text area is arranged horizontally or vertically, ensuring that the text is placed horizontally, and improving the accuracy of text detection.
[0079] S2: Dataset division: The preprocessed dataset is divided into three subsets: training set, validation set and test set. The training set is used for model training, the validation set is used for error calculation and parameter adjustment during model training, and the test set is used to evaluate the performance of the model.
[0080] S201: Training set: The training set is used for the training process of the model by learning the parameters of the mapping from the input image to the output text area. The data volume of the specific training set contains most of the data in the dataset, but the volume ratio depends on the size of the dataset and the available computing resources.
[0081] S202: Validation set: The validation set is used to evaluate the performance of the model during the model training process and adjust the parameters or hyperparameters of the model based on the evaluation results. The main purpose of the validation set is to prevent overfitting and ensure that the model has good generalization ability on unseen data. The amount of data in the validation set is usually smaller than that in the training set to ensure reliable performance evaluation. The common division ratio is 70% for the training set and 15% for the validation set.
[0082] S203: The test set is used to evaluate the final performance of the model after the model training is completed. The test set provides an independent and fair evaluation standard to determine whether the model has truly learned to extract text areas from the input image. The amount of data in the test set is usually smaller than that in the training set to provide an independent and fair evaluation standard. The common division ratio is 70% for the training set, 15% for the validation set, and 15% for the test set.
[0083] S3: Model building and training: Build a DBNet model for text detection, train the model using the training set, and use the validation set to evaluate the model performance and make adjustments to achieve better text detection results;
[0084] S301: Build the model: Select DBNet as the text detection model and build the corresponding network structure. DBNet is a segmentation-based text detection method that can effectively detect text areas in images. When building the model, you need to define the network's hierarchy, activation function, loss function, etc., and initialize the model's parameters.
[0085] S302: Model training: Use the training set to train the DBNet model. During the training process, the parameters of the model are continuously updated through the back propagation algorithm and the gradient descent optimizer to minimize the error between the predicted results and the true labels. The images in the training set will be input into the model, and the model will make predictions based on the current parameters. Then, the error between the predicted results and the labels is calculated, and the parameters are updated through the optimizer.
[0086] S303: Verification and adjustment: During the training process, the model is verified using the validation set. The performance of the model is evaluated by calculating the performance indicators of the model on the validation set, such as accuracy, recall, F1 score, etc. Based on the verification results, the model's hyperparameters such as learning rate, batch size, etc. or the network structure can be adjusted to optimize the model's performance. This process usually includes multiple iterations of training and verification until satisfactory performance is achieved.
[0087] S4: Model verification and evaluation: After the model training is completed, the model is finally verified and evaluated using the test set. The performance indicators of the model on the test set are calculated to evaluate the performance of the model in practical applications. The text detection effect of the model can be further verified by visualizing the results or manually checking them.
[0088] S5: Apply the model: Use the trained DBNet model to perform text detection on production logging archive data. Input the image to be detected into the model, and the model will output the location and size information of the text area in the image. Based on this information, the text can be further recognized and processed.
[0089] The text recognition method includes the following steps:
[0090] S1: Data preprocessing: Similar to S1 in the text detection method, the original image is converted into a grayscale image, the color information is removed, and then binarization is performed to convert the image into a simple black and white binary image. Next, the tilted image is corrected to make it horizontal;
[0091] S2: Dataset division: Similar to S2 in the text detection method, the preprocessed dataset is divided into training set, validation set and test set for model training, validation and evaluation;
[0092] S3: Model training: Build a text recognition CRNN network model and train it using the training set. By inputting the training set images and corresponding labels, the model parameters are updated using the error calculation and back propagation methods to improve the accuracy of the model in text recognition.
[0093] S301: Build a CRNN text recognition model. The CRNN model combines the advantages of convolutional neural network (CNN) and recurrent neural network (RNN), and can simultaneously process the sequence information and spatial information of the image.
[0094] S302: Use the training set to train the CRNN model. During the training process, use the validation set to perform error calculation and model parameter update to optimize the performance of the model.
[0095] S303: The text detection method adopts the DBNet network, which includes a backbone network, feature extraction and feature prediction. The network models used are a deep residual network (ResNet18), a feature pyramid network (FPN) network and a differentiable binary feature prediction module (DBHead).
[0096] S4: Model verification: Use the test set to verify the trained CRNN model, input the test set images into the model, compare the text results output by the model with the true labels, and evaluate the performance of the model in text recognition. Indicators such as accuracy and edit distance can be used for evaluation to determine the accuracy and robustness of the model.
[0097] S5: Application model: Use the trained CRNN model to perform text recognition on production logging archive data, input the image to be recognized into the model, and the model will output the recognition result.
[0098] For details, please refer to Figure 5 As shown in the figure, due to some interference production logging program data, the original image may be interfered by factors such as blur, noise, and low contrast. Different images may have different brightness, contrast, and color distribution, which will affect the performance of the subsequent processing algorithm. Preprocessing can remove or reduce the interference of the image, improve the clarity and quality of the image, and normalize the pixel values of the image to the same range or scale to make different images comparable. The useful information extracted by preprocessing can facilitate subsequent analysis and processing. After the data preprocessing is completed, the preprocessed images are input into the DBNet network and the CRNN network in turn;
[0099] See also Figure 6 As shown in the figure, the DBNet network uses the Adam optimizer for optimization, and the initial learning rate is set to 0.001. During the training process, when the 40th and 45th cycles are reached, the learning rate is adjusted to 0.0001 and 0.00005 respectively. On the RTX4090GPU device, in the virtual environment of PaddlePaddle2.4.0, Python3.8 and Cuda11.2, the DBNet network training process first processes the data set, including data set collection, data set preprocessing and data set division. The model divides the data set into a training set and a test set, of which 80% is divided into the training set and 20% is divided into the test set. Then, to train the data set, we must first build the DBNet network and pre-train the DBNet network, and then adjust the model parameters such as epoch_num, lr, etc., train the data set, calculate the accuracy and loss value, and then adjust the parameters in a cycle to achieve the optimal effect, that is, to obtain the required model, and finally use the test set to test the model to clarify whether the model achieves the expected effect. If it meets the actual expectations, a DBNet network suitable for production logging archive data is generated.
[0100] See also Figure 7As shown in the figure, the network is optimized using the Adam optimizer, and the initial learning rate is set to 0.001. During the training process, when the 30th and 53rd cycles are reached, the learning rate is adjusted to 0.0001 and 0.00005 respectively. On the RTX4090 GPU device, in the virtual environment of PaddlePaddle2.4.0
[14] , Python3.8 and Cuda11.2, the CRNN network training process first processes the dataset, including dataset collection, dataset preprocessing and dataset partitioning. The model divides the dataset into a training set and a test set, of which 80% is divided into the training set and 20% is divided into the test set. Then, the dataset is trained: first, the CRNN network and the pre-trained CRNN network are built, and then the model parameters such as epoch_num and lr are adjusted. Then the dataset is trained: the accuracy and loss value are calculated, and the parameters are adjusted in a loop to achieve the optimal effect, that is, the desired model is obtained; finally, the model is tested using the test set to determine whether the model achieves the expected effect. If it achieves the actual expectation, a DBNet network suitable for production logging archive data is generated.
[0101] The above contents are only for explaining the technical idea of the present invention and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the claims of the present invention.
[0102] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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, article or device.
[0103] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. An OCR recognition method for archival data of production logging, including a DBNet-based text detection method and a CRNN-based text recognition method, characterized in that: The text detection method includes the following steps: S1: Data preprocessing: By participating in a project development of a petroleum company in Daqing, we collected production logging archive data sets, including original production logging maps, injection profile logging geological design, and perforation depth notices. We preprocessed the collected production logging archive data images and data, including grayscale, binarization, and image tilt correction of the data sets; S2: Dataset division: The preprocessed dataset is divided into three subsets: training set, validation set and test set. The training set is used for model training, the validation set is used for error calculation and parameter adjustment during model training, and the test set is used to evaluate the performance of the model. S3: Model building and training: Build a DBNet model for text detection, train the model using the training set, and use the validation set to evaluate the model performance and make adjustments to achieve better text detection results; S4: Model verification and evaluation: After the model training is completed, the model is finally verified and evaluated using the test set. The model performance is evaluated by calculating the performance indicators of the model on the test set. The text detection effect of the model is further verified by visualizing the results. S5: Apply the model: Use the trained DBNet model to perform text detection on production logging archive data. Input the image to be detected into the model, and the model will output the location and size information of the text area in the image. Based on this information, the text is further recognized and processed. The text recognition method includes the following steps: S1: Data preprocessing: Similar to S1 in the text detection method, the original image is converted into a grayscale image, the color information is removed, and then binarization is performed to convert the image into a simple black and white binary image, and the tilted image is corrected to make it horizontal; S2: Dataset division: Similar to S2 in the text detection method, the preprocessed dataset is divided into training set, validation set and test set for model training, validation and evaluation; S3: Model training: Build a text recognition CRNN network model and train it using the training set. By inputting the training set images and corresponding labels, the model parameters are updated using the error calculation and back propagation methods to improve the accuracy of the model in text recognition. S4: Model verification: Use the test set to verify the trained CRNN model, input the test set images into the model, compare the text results output by the model with the true labels, evaluate the performance of the model in text recognition, and use accuracy and edit distance indicators to evaluate and judge the accuracy of the model; S5: Application model: Use the trained CRNN model to perform text recognition on production logging archive data, input the image to be recognized into the model, and the model will output the recognition result.
2. The OCR recognition method for production logging archival data according to claim 1, characterized in that: The text detection method S1 includes the following steps: S101: Grayscale conversion: Convert the color image of production logging archive data into a grayscale image, that is, convert the information of various colors in the image into grayscale values, so that the image only contains grayscale information and no longer has color information. The grayscale value of each pixel in the grayscale image is between 0 and 255, indicating different grayscale levels from black to white. These methods cover a variety of strategies including component method, maximum value method, average value method and weighted average method to reduce the amount of calculation while retaining the key information of the image and simplifying the processing process. Based on the characteristics of production logging archive data, the grayscale weighted average method is used, as shown in the following formula: F(i,j)=0.2989R(i,j)+0.5370G(i,j)+0.1140B(i,j) S102: Binarization: Image binarization converts complex grayscale or color images into simple binary images. Converting grayscale images or color images into image types containing only two grayscale levels is called a binary image. Binarization methods include simple threshold method, mean method, Gaussian method and Otsu's method. Combined with the characteristics of the production logging archive data set, Otsu's method is used to make the production logging archive data set transition from grayscale to binary. S103: Image tilt correction: Image tilt correction is to solve the tilt problem caused by shooting angle or other reasons, and convert the tilted image into a horizontal image. Correcting the tilted image is the third step of preprocessing for identifying logging data. It is a necessary step before identifying logging data. This preprocessing step will improve the efficiency of identifying logging data and the visibility of the image. The implementation principle is to convert the image origin and the Cartesian coordinate origin. First, the origin in the upper left corner needs to be transferred to the center of the image, and then a specified angle is selected for selection. Finally, the coordinates are transferred from the center origin to the upper left corner. For tilted images, the tilted text in the image is detected and corrected, so that the text area is arranged horizontally or vertically, ensuring that the text is placed horizontally, and improving the accuracy of text detection.
3. The OCR recognition method for archival data of production logging according to claim 1, characterized in that: The text detection method S2 includes the following steps: S201: Training set: The training set is used in the training process of the model by learning the parameters of the mapping from the input image to the output text area. The data volume of the specific training set contains most of the data in the dataset, but the proportion depends on the size of the dataset and the available computing resources.
4. The OCR recognition method for archival data of production logging according to claim 3 is characterized in that: The text detection method S2 includes the following steps: S202: Validation set: The validation set is used to evaluate the performance of the model during the model training process and adjust the parameters of the model based on the evaluation results. The main purpose of the validation set is to prevent overfitting and ensure that the model has good generalization ability on unseen data. The amount of data in the validation set is smaller than that in the training set to ensure reliable performance evaluation. The division ratio is 70% for the training set and 15% for the validation set.
5. The OCR recognition method for archival data of production logging according to claim 4 is characterized in that: The text detection method S2 includes the following steps: S203: The test set is used to evaluate the final performance of the model after the model training is completed. The test set provides an independent and fair evaluation standard to determine whether the model has truly learned to extract text areas from the input image. The amount of data in the test set is also smaller than that in the training set to provide an independent and fair evaluation standard. The division ratio is 70% for the training set, 15% for the validation set, and 15% for the test set.
6. The OCR recognition method for production logging archival data according to claim 1, characterized in that: S3 in the text detection method includes the following steps: S301: Build the model: Select DBNet as the text detection model and build the corresponding network structure. DBNet is a segmentation-based text detection method that effectively detects text areas in images. When building the model, you need to define the network's hierarchy, activation function, loss function, and initialize the model's parameters.
7. The OCR recognition method for archival data of production logging according to claim 6 is characterized in that: S3 in the text detection method includes the following steps: S302: Model training: Use the training set to train the DBNet model. During the training process, the parameters of the model are continuously updated through the back propagation algorithm and the gradient descent optimizer to minimize the error between the predicted results and the true labels. The images in the training set will be input into the model, and the model will make predictions based on the current parameters. Then, the error between the predicted results and the labels is calculated, and the parameters are updated through the optimizer.
8. The OCR recognition method for archival data of production logging according to claim 7, characterized in that: S3 in the text detection method includes the following steps: S303: Verification and adjustment: During the training process, the model is verified using the verification set. The performance of the model is evaluated by calculating the performance indicators of the model on the verification set. Based on the verification results, the hyperparameter network structure of the model is adjusted to optimize the performance of the model. This process includes multiple iterations of training and verification until satisfactory performance is achieved.
9. The OCR recognition method for archival data of production logging according to claim 1, characterized in that: The text recognition method S3 comprises the following steps: S301: Build a CRNN text recognition model. The CRNN model combines the advantages of convolutional neural network (CNN) and recurrent neural network (RNN), and can simultaneously process the sequence information and spatial information of the image.
10. The OCR recognition method for production logging archival data according to claim 9, characterized in that: The text recognition method S3 comprises the following steps: S302: Use the training set to train the CRNN model. During the training process, use the validation set to perform error calculation and model parameter update to optimize the performance of the model.
Citation Information
Cited By
Archive key element identification and classification method based on improved LSTM semantic modeling
CN119026601A
File digital management system and method
CN119692937A
Historical data migration method and device of oil and gas field database, equipment and medium
CN120216461A
Historical data migration method, device, equipment and medium for oil and gas field database
CN120216461B
