CN113420689A - Character recognition method and device based on probability calibration, computer equipment and medium - Google Patents

Character recognition method and device based on probability calibration, computer equipment and medium Download PDF

Info

Publication number
CN113420689A
CN113420689A CN202110735014.8A CN202110735014A CN113420689A CN 113420689 A CN113420689 A CN 113420689A CN 202110735014 A CN202110735014 A CN 202110735014A CN 113420689 A CN113420689 A CN 113420689A
Authority
CN
China
Prior art keywords
probability
recognition
preset
samples
character recognition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110735014.8A
Other languages
Chinese (zh)
Other versions
CN113420689B (en
Inventor
洪振厚
王健宗
瞿晓阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202110735014.8A priority Critical patent/CN113420689B/en
Publication of CN113420689A publication Critical patent/CN113420689A/en
Application granted granted Critical
Publication of CN113420689B publication Critical patent/CN113420689B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2415Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Abstract

The application belongs to the technical field of artificial intelligence and provides a character recognition method and device based on probability calibration, computer equipment and a computer readable storage medium. According to the method, the initial recognition image is obtained, the initial recognition image is input to the preset DARTS model, character recognition is carried out on the initial recognition image, calibration parameters of characters contained in the initial recognition image are obtained, the initial recognition image is input to the preset OCR model, character recognition is carried out on the initial recognition image, character recognition logs probability vectors corresponding to the characters contained in the initial recognition image are obtained, probability calibration is carried out on the character recognition logs probability vectors according to the calibration parameters, normalization processing is carried out, character recognition results of the characters contained in the initial recognition image are obtained, calibration problems of recognition error rate can be solved through increasing of character recognition probability, and accuracy of character prediction in character recognition is improved.

Description

Character recognition method and device based on probability calibration, computer equipment and medium
Technical Field
The application relates to the technical field of artificial intelligence, in particular to the technical field of image detection, and specifically relates to a character recognition method and device based on probability calibration, computer equipment and a computer-readable storage medium.
Background
For OCR (Optical Character Recognition, english) and many application scenarios, information extraction of various certificates is performed, for example, names on certificates are acquired on provided certificates, and in many scenarios, names on certificates can be correctly recognized, so that a business process can be greatly simplified, efficiency is improved, counterfeiting can be prevented, and false information is avoided.
Although the accuracy of optical text recognition characters is increasing, errors in recognizing characters persist, and it is therefore important to determine when and where recognition errors occur and to correct the word recognition errors that occur. However, in the conventional classifier (for example, SVM), automatic correction of the generated text recognition error is not realized.
Disclosure of Invention
The application provides a character recognition method and device based on probability calibration, computer equipment and a computer readable storage medium, which can solve the technical problem that automatic calibration is not carried out on the generated character recognition errors in the traditional technology.
In a first aspect, the present application provides a text recognition method based on probability calibration, including: acquiring an initial identification image, inputting the initial identification image to a preset DARTS model, and performing character identification on the initial identification image to obtain a calibration parameter of characters contained in the initial identification image; inputting the initial recognition image to a preset OCR model, and performing character recognition on the initial recognition image to obtain a character recognition logs probability vector corresponding to characters contained in the initial recognition image; and according to the calibration parameters, carrying out probability calibration on the probability vectors of the character recognition logs and carrying out normalization processing to obtain a character recognition result of characters contained in the initial recognition image. .
In a second aspect, the present application further provides a text recognition apparatus based on probability calibration, including: the system comprises a first identification unit, a second identification unit and a third identification unit, wherein the first identification unit is used for acquiring an initial identification image, inputting the initial identification image to a preset DARTS model, and performing character identification on the initial identification image to obtain a calibration parameter of characters contained in the initial identification image; the second identification unit is used for inputting the initial identification image to a preset OCR model, performing character identification on the initial identification image and obtaining a character identification Logits probabilistic vector corresponding to characters contained in the initial identification image; and the calibration identification unit is used for carrying out probability calibration on the character recognition logs probability vector according to the calibration parameters and carrying out normalization processing to obtain a character recognition result of characters contained in the initial recognition image.
In a third aspect, the present application further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the text recognition method based on probability calibration when executing the computer program.
In a fourth aspect, the present application further provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, causes the processor to carry out the steps of the probabilistic calibration based word recognition method.
The application provides a character recognition method and device based on probability calibration, computer equipment and a computer readable storage medium. The method comprises the steps of acquiring an initial identification image, inputting the initial identification image to a preset DARTS model, performing character recognition on the initial recognition image to obtain calibration parameters of characters contained in the initial recognition image, inputting the initial recognition image to a preset OCR model, performing character recognition on the initial recognition image to obtain a character recognition logs probability vector corresponding to characters contained in the initial recognition image, according to the calibration parameters, carrying out probability calibration on the probability vectors of the character recognition logs and carrying out normalization processing to obtain a character recognition result of characters contained in the initial recognition image, therefore, by increasing the calibration error of the character recognition probability, the self-adaptive calibration of OCR character recognition is realized, the calibration problem of the recognition error rate can be solved, the manual intervention is reduced, and the accuracy of character prediction in character recognition is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a text recognition method based on probability calibration according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of an overall system framework structure of a text recognition method based on probability calibration according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a DARTS model framework in a text recognition method based on probability calibration according to an embodiment of the present application;
fig. 4 is a schematic diagram of a character recognition model SRN model in the character recognition method based on probability calibration according to the embodiment of the present application;
fig. 5 is a schematic view of a first sub-flow of a text recognition method based on probability calibration according to an embodiment of the present application;
fig. 6 is a schematic view of a second sub-flow of a text recognition method based on probability calibration according to an embodiment of the present application;
fig. 7 is a third sub-flowchart of a text recognition method based on probability calibration according to an embodiment of the present application;
fig. 8 is a fourth sub-flowchart of the text recognition method based on probability calibration according to the embodiment of the present application;
fig. 9 is a fifth sub-flowchart of a text recognition method based on probability calibration according to an embodiment of the present application;
FIG. 10 is a schematic block diagram of a text recognition device based on probability calibration according to an embodiment of the present application; and
fig. 11 is a schematic block diagram of a computer device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic flow chart of a text recognition method based on probability calibration according to an embodiment of the present disclosure, and fig. 2 is a schematic general system frame structure of the text recognition method based on probability calibration according to the embodiment of the present disclosure. As shown in fig. 1 and 2, the method includes the following steps S11-S13:
s11, acquiring an initial recognition image, inputting the initial recognition image to a preset DARTS model, and performing character recognition on the initial recognition image to obtain calibration parameters of characters contained in the initial recognition image.
The DARTS model is a differential Architecture Search, and is used for identifying characters contained in the initial identification image, and searching calibration parameters describing an optimal global neural network structure from a preset candidate neural network substructure set called a Search space according to the identification of the characters, wherein the calibration parameters comprise Weight (Weight in English, which can be abbreviated as W) and Bias (Bias in English, which can be abbreviated as B), and the Bias value of the Bias is used for shifting an activation function to the left or the right so as to adjust the identification result of the characters.
Specifically, Neural network structure Search (referred to as Neural network Architecture Search, or NAS for short) is to give a candidate Neural network substructure set called a Search space, Search out an optimal global Neural network structure from the candidate Neural network substructure set by using a preset Search strategy, measure the quality (i.e., performance) of the Neural network structure by using preset indexes such as precision, speed, weight, and bias, and Search for optimal parameters in a high-dimensional space, which is referred to as performance evaluation, and a dart model is to convert discrete Architecture Search into continuous Architecture weight Search. In order to realize the probability calibration of character recognition, a dart model is introduced, an initial recognition image is obtained, the initial recognition image is input to a preset dart model, character recognition is performed on the initial recognition image through the preset dart model, and the preset dart model outputs calibration parameters of characters contained in the initial recognition image according to recognition of character features (which may also be referred to as image features) of characters contained in the initial recognition image. Referring to fig. 2 and 3, fig. 3 is a schematic diagram of a dart model framework in the text recognition method based on probability calibration according to the embodiment of the present application, where the dart is composed of five cells shown in fig. 3, namely three Normal cells and two Reduction cells, each Cell is composed of 4 nodes, and lines between the nodes represent operations. The operations shared a deep convolution of 3x3 and 5x5, a void convolution of 3x3 and 5x5, a max pooling of 3x3, and an average pooling of 3x 3. The Normal Cell and the Reduction Cell are different due to max and average firing, since firing is an operation of reducing the size of the picture.
The loss function is shown by the following formula:
f*=argmaxM(f(θ*),Dvalid) Formula (1)
θ*=argminL(f(θ),Dtrain) Formula (2)
Wherein f is the best function, and M is the measurement mode based on the highest searched accuracy. DvalidIs data for valid, θ*Is an optimum parameter, DtrainIs the data used for training (i.e., Train).
As shown in fig. 1 and 2, acquiring initial recognition Images, inputting the initial recognition Images to a preset DARTS model, where the preset DARTS is used to search for an optimal calibration probability model, so as to obtain calibration parameters of characters contained in the initial recognition Images: weight W (i.e., Weights) and Bias B (i.e., Bias).
And S12, inputting the initial recognition image to a preset OCR model, and performing character recognition on the initial recognition image to obtain a character recognition logs probability vector corresponding to characters contained in the initial recognition image.
Specifically, an initial Recognition image is obtained, and the initial Recognition image is input to a preset OCR model (OCR for short, and Optical Character Recognition for short, and may also be referred to as Character Recognition), where the preset OCR model may be a space-normalized Network model (SRN for short) based on deep learning, please refer to fig. 4, where fig. 4 is a schematic diagram of a Character Recognition model SRN model in the Character Recognition method based on probability calibration provided in this embodiment of the present application, as shown in fig. 4, an SRN model (i.e., an OCR model for Character Recognition, but not limited to an SRN model) in a general frame diagram of the system of fig. 2 is shown, where p and r in the diagram are respectively a probability value and a coordinate position of a Character, SOS is a start Character, and EOS is an end Character. In the SRN model, CNN comprises 5 convolutional layers and 5 pooling layers, each convolutional layer has a convolutional kernel of 3x3, stride of 1 and channel number of 32,64,128,256 and 256 respectively. The pooling layer is the maximum pooling layer, the core size is 2x2, and stride is 2. The hidden layer cell of BilSTM (bidirectional LSTM) is 128, and the hidden layer cell of GRU (gate Recurrent Unit) is also 128. The imbedding size of the Attention (i.e. Attention layer) is 10.
The formula for the calibrated metric is as follows:
Figure BDA0003141290670000061
Figure BDA0003141290670000062
Figure BDA0003141290670000063
Figure BDA0003141290670000064
equation (3) is the pairing of the predictive label and the predictive probability,
Figure BDA0003141290670000065
is a predictive label that is a label for the prediction,
Figure BDA0003141290670000066
is the prediction probability, M is the number of samples from the test set, equation (4) is the average prediction probability calculation, | Bm | describes the number of pairs of prediction labels and prediction probabilities for averaging, equation (5) is the text recognition accuracy calculation (i.e., the ratio of the number of correct text recognitions to the total number of recognitions), wherein,
Figure BDA0003141290670000067
for the ith predictive tag, yiIs prepared by reacting with
Figure BDA0003141290670000068
For the correct label, equation (6) is the Expected Calibration Error (ECE), and n is the test set size.
Referring to fig. 4, as shown in fig. 4, the initial recognition image is subjected to normal character recognition, and according to recognized character features, a probability vector of character recognition logs corresponding to characters included in the initial recognition image is obtained, where the logs are probability vectors that are normalized by softmax in a preset OCR model, and are generally output of a full link layer and input of softmax, where a softmax function is also called a normalization index function. It is a binary function, aiming at showing the result of multi-classification in the form of probability.
And S13, performing probability calibration on the text recognition logs probability vector according to the calibration parameters, and performing normalization processing to obtain a text recognition result of the text contained in the initial recognition image.
Specifically, after calibration parameters of characters contained in the initial recognition image are acquired, and a preset OCR model is used to acquire a character recognition logs probabilistic vector corresponding to the characters contained in the initial recognition image, before normalization processing is performed on the character recognition logs probabilistic vector, probability calibration and normalization processing are performed on the character recognition logs probabilistic vector according to the calibration parameters, so that a character recognition probability corresponding to the characters contained in the normalized initial recognition image is acquired, and a target recognition character corresponding to the image characters contained in the initial recognition image based on an image format is acquired according to the character recognition probability, that is, when character recognition is performed based on deep learning, accuracy of character prediction in character recognition can be improved by increasing calibration errors of the character recognition probability. With continued reference to fig. 1, calibration parameters of the text included in the initial recognition Images are obtained: weight W (Weights) and Bias B (Bias), and obtaining the text recognition logs probability vector corresponding to the text contained in the initial recognition image, inputting the weight W, the bias B and the probability vector z of the character recognition logs into softmax for calculation, the character recognition Calibration probability Calibration after the probability Calibration is carried out on the character recognition logs probability vector can be obtained, the text recognition Calibration probability is used to describe the probability of recognizing the text image a included in the initial recognition image as the text a', and the image characters based on the image form contained in the initial recognition image are recognized as corresponding target recognition characters according to the character recognition Calibration probability, therefore, the probability of error occurrence in character recognition of the preset OCR recognition model SRN is corrected in an auxiliary mode through the preset DARTS model, and the accuracy of character recognition of the initial recognition image by the preset OCR recognition model SRN is improved.
In the embodiment of the application, by obtaining an initial recognition image, inputting the initial recognition image to a preset DARTS model, performing character recognition on the initial recognition image to obtain a calibration parameter of characters contained in the initial recognition image, inputting the initial recognition image to a preset OCR model, performing character recognition on the initial recognition image to obtain a character recognition logs probability vector corresponding to the characters contained in the initial recognition image, performing probability calibration on the character recognition logs probability vector according to the calibration parameter, performing normalization processing on the probability calibration parameter to obtain a character recognition result of the characters contained in the initial recognition image, a target recognition character corresponding to the image characters based on an image form contained in the initial recognition image and a character recognition probability corresponding to the target character can be obtained, so that a calibration error of the character recognition probability is increased, the method realizes the self-adaptive calibration, can solve the calibration problem of the recognition error rate, reduces the manual intervention, and improves the accuracy of character prediction in character recognition.
Referring to fig. 5, fig. 5 is a schematic sub-flow chart of a text recognition method based on probability calibration according to an embodiment of the present application. As shown in fig. 5, in this embodiment, the text recognition result includes a target recognition text corresponding to a text included in the initial recognition image and a text recognition probability of the target recognition text, and after the step of obtaining the text recognition result of the text included in the initial recognition image, the method further includes:
s14, judging whether the character recognition probability is larger than or equal to a preset first probability threshold value;
s15, if the character recognition probability is greater than or equal to a preset first probability threshold, classifying the character recognition probability and the target recognition characters corresponding to the character recognition probability into a preset high probability sample set;
s16, extracting a preset first number of samples from the preset high probability sample set to serve as high probability samples, and displaying the high probability samples so that a user can confirm the high probability samples;
and S17, if the character recognition probability is smaller than a preset first probability threshold, not classifying the character recognition probability and the target recognition characters corresponding to the character recognition probability into a preset high probability sample set.
Specifically, a character recognition result of the character included in the initial recognition image is obtained, the character recognition result may include a target recognition character corresponding to the character included in the initial recognition image and a character recognition probability of the target recognition character, the higher the character recognition probability, the closer the character recognition probability to the real character, the more accurate the target recognition character, the lower the character recognition probability, the less accurate the character recognition probability to the real character, the less accurate the target recognition character, and the target recognition character corresponding to the character recognition probability is classified according to the character recognition probability, and whether the character recognition probability is greater than or equal to a preset first probability threshold is determined, if the character recognition probability is greater than or equal to the preset first probability threshold, classifying the character recognition probability and the target recognition characters corresponding to the character recognition probability into a preset high probability sample set, if the character recognition probability is smaller than a preset first probability threshold, not classifying the character recognition probability and the target recognition characters corresponding to the character recognition probability into the preset high probability sample set, then extracting a preset first number of samples from the preset high probability sample set as high probability samples, displaying the high probability samples to ensure that a user confirms the high probability samples, confirming the high probability samples by the user, manually checking the high probability samples by the user, checking the accuracy of character recognition, realizing self-adaptive calibration without eliminating the process of manual checking, introducing manual checking to form a closed loop of a system, and increasing the recyclable use of data, the calibration efficiency of the model is improved, and the recognition efficiency of the model is further improved.
Referring to fig. 6, fig. 6 is a schematic view of a second sub-flow of a text recognition method based on probability calibration according to an embodiment of the present application. As shown in fig. 6, in this embodiment, after the step of classifying the text recognition probability and the target recognition text corresponding to the text recognition probability into a preset high probability sample set if the text recognition probability is greater than or equal to a preset first probability threshold, the method further includes:
s18, judging whether the character recognition probability is smaller than or equal to a preset second probability threshold value;
s19, if the character recognition probability is smaller than or equal to a preset second probability threshold, classifying the character recognition probability and the target recognition characters corresponding to the character recognition probability into a preset low probability sample set;
s20, extracting a preset second number of samples from the preset low probability sample set to serve as low probability samples, and displaying the low probability samples so that a user can confirm the low probability samples;
and S21, if the character recognition probability is greater than a preset second probability threshold, not classifying the character recognition probability and the target recognition characters corresponding to the character recognition probability into a preset low probability sample set.
The preset first probability threshold and the preset second probability threshold may be the same or different, and when the preset first probability threshold and the preset second probability threshold are the same, the text recognition probability is equal to the preset second probability threshold, and the text recognition probability and the target recognition text corresponding to the text recognition probability can only belong to a preset low probability sample set or only belong to a preset high probability sample set.
Specifically, a character recognition result of the characters contained in the initial recognition image is obtained, where the character recognition result may include a target recognition character corresponding to the characters contained in the initial recognition image and a character recognition probability of the target recognition character, and the character recognition probability and the target recognition character corresponding to the character recognition probability are classified according to the character recognition probability, and whether the character recognition probability is smaller than or equal to a preset second probability threshold is determined, if the character recognition probability is smaller than or equal to the preset second probability threshold, the character recognition probability and the target recognition character corresponding to the character recognition probability are classified into a preset low probability sample set, and if the character recognition probability is greater than the preset second probability threshold, the target recognition character corresponding to the character recognition probability and the character recognition probability is not classified into a preset low probability sample set, then, a preset second number of samples are extracted from the preset low probability sample set to serve as low probability samples, the low probability samples are displayed so that a user can confirm the low probability samples, the low probability samples are confirmed by the user, and the low probability samples can be manually checked by the user to check the low probability samples for which reasons cause low probability, for example, whether the samples are few corresponding samples or whether the samples are mislabeled, and the like.
Referring to fig. 7, fig. 7 is a third sub-flowchart of a text recognition method based on probability calibration according to an embodiment of the present disclosure. As shown in fig. 7, in this embodiment, after the step of extracting a preset second number of samples from the preset low probability sample set as low probability samples and displaying the low probability samples so that the user confirms the low probability samples, the method further includes:
s22, judging whether the high probability sample or the low probability sample is modified;
s23, if the high probability sample or the low probability sample is modified, obtaining a modified sample corresponding to the high probability sample or the low probability sample, and performing character recognition on the modified sample again;
and S24, if the high probability sample or the low probability sample is not modified, not carrying out character recognition on the modified sample again.
Specifically, after the high probability sample or the low probability sample is checked and confirmed by a user, if the high probability sample or the low probability sample has an identification error, the high probability sample or the low probability sample can be modified by the user, and the computer device compares the high probability sample or the low probability sample before and after the user confirmation to determine whether the high probability sample or the low probability sample is modified, if the high probability sample or the low probability sample before and after the user confirmation is consistent, it indicates that the high probability sample or the low probability sample is not modified, and there is no error in the identification of the target characters corresponding to the high probability sample or the low probability sample, and no further processing is needed, if the high probability sample or the low probability sample before and after the user confirmation is inconsistent, the high probability sample or the low probability sample is modified, the modified sample is used for circularly training the character recognition model, the sample data which is manually checked and arranged is returned to the initial training data, a closed loop of probability calibration is formed, the initial recognition image can be fully used as the training sample, and the training efficiency of the character recognition model can be improved.
Referring to fig. 8, fig. 8 is a fourth sub-flowchart of the text recognition method based on probability calibration according to the embodiment of the present disclosure. As shown in fig. 8, in this embodiment, the step of extracting a preset second number of samples from the preset low probability sample set as the low probability samples includes:
s201, sequencing all the low-probability samples contained in the preset low-probability sample set according to the character recognition probability corresponding to the low-probability sample from small to large to obtain a low-probability sample sequencing queue;
s202, according to the low-probability sample sorting queue, extracting a preset second number of samples from the low-probability sample sorting queue as low-probability samples in a sequence from small to large.
Specifically, for the preset low probability sample set, all the low probability samples included in the preset low probability sample set may be sorted according to the character recognition probability corresponding to the low probability sample from small to large to obtain a low probability sample sorting queue, and according to the low probability sample sorting queue, a preset second number of samples with the lowest character recognition probability are extracted from the low probability sample sorting queue according to the order from small to large as the low probability sample, because the lower the character recognition probability is, the less the character recognition probability is close to the true probability, the more the target recognized character is, the more the problem corresponding to the error of the character recognition can be reflected, so that the preset second number of samples with the lowest character recognition probability can be extracted from the low probability sample sorting queue as the low probability sample, through manual confirmation, the problems existing in the character recognition process are found to the greatest extent possible, and the maximum problems existing are solved as much as possible through a manual mode, so that the accuracy and the efficiency of subsequent character recognition are improved.
Referring to fig. 9, fig. 9 is a fifth sub-flowchart of the text recognition method based on probability calibration according to the embodiment of the present application. As shown in fig. 9, in this embodiment, the step of extracting a preset second number of samples from the preset low probability sample set as the low probability samples includes:
s203, counting the number of low-probability samples of the low-probability samples contained in the preset low-probability sample set;
s204, judging whether the number of the low-probability samples is less than or equal to the preset second number;
s205, if the number of the low probability samples is less than or equal to the preset second number, obtaining all low probability samples contained in the preset low probability sample set;
s206, if the number of the low probability samples is larger than the preset second number, the low probability samples are extracted from the preset low probability sample set one by one, and the samples with the preset second number are obtained and used as the low probability samples.
Specifically, when a preset second number of samples are extracted from the preset low probability sample set as the low probability samples, the number of the low probability samples included in the preset low probability sample set may be counted in advance, whether the number of the low probability samples is smaller than or equal to the preset second number is determined, if the number of the low probability samples is smaller than or equal to the preset second number, all the low probability samples included in the preset low probability sample set are directly obtained, and if the number of the low probability samples is greater than the preset second number, the low probability samples are selected from the preset low probability sample set one by one to obtain the preset second number of samples as the low probability samples, so that the efficiency of extracting the low probability samples can be improved.
In one embodiment, before the step of acquiring the initial identification image, the method further includes:
the method comprises the steps of obtaining an original image, and preprocessing the original image according to a preset preprocessing mode to obtain an initial identification image.
Specifically, an original image to be subjected to character recognition is obtained, and the original image is preprocessed according to a preset preprocessing manner, for example, brightness adjustment or contrast adjustment is performed on the original image, pixel normalization processing is performed on the original image, so as to improve the image quality of the initial recognized image, and improve the accuracy of character recognition, and if a character recognition model is trained, the recognition accuracy and recognition efficiency of the character recognition model can be improved, wherein the brightness adjustment on the original image can adopt the following brightness adjustment formula:
brightness adjustment formula: i ═ IgFormula (1)
The method comprises the steps that I' is a pixel value of an initial recognition image corresponding to an original image after preprocessing, I is the pixel value of the original image, g is gamma, if g is larger than 1, the initial recognition image is darker than the original image, if g is smaller than 1, the initial recognition image is brighter than the original image, and according to experience, the value range of general g is between 0.5 and 2.
The contrast of the original image is adjusted by using the following contrast adjustment formula:
contrast adjustment formula: i ═ log (I) formula (2)
Where I' is the pixel value of the initial recognition image and I is the pixel value of the original image.
It should be noted that, the text recognition method based on probability calibration described in the foregoing embodiments may recombine technical features included in different embodiments as needed to obtain a combined implementation, but all of the text recognition methods are within the protection scope of the present application.
Referring to fig. 10, fig. 10 is a schematic block diagram of a text recognition device based on probability calibration according to an embodiment of the present application. Corresponding to the character recognition method based on probability calibration, the embodiment of the application also provides a character recognition device based on probability calibration. As shown in fig. 10, the text recognition apparatus based on probability calibration includes a unit for executing the text recognition method based on probability calibration, and the text recognition apparatus based on probability calibration may be configured in a computer device. Specifically, referring to fig. 10, the text recognition device 100 based on probability calibration includes a first recognition unit 101, a second recognition unit 102, and a calibration recognition unit 103.
The first identification unit 101 is configured to acquire an initial identification image, input the initial identification image to a preset DARTS model, and perform character identification on the initial identification image to obtain a calibration parameter of characters included in the initial identification image;
the second recognition unit 102 is configured to input the initial recognition image to a preset OCR model, perform character recognition on the initial recognition image, and obtain a character recognition logs probabilistic vector corresponding to characters included in the initial recognition image;
and the calibration identification unit 103 is configured to perform probability calibration on the text recognition logs probabilistic vectors according to the calibration parameters and perform normalization processing to obtain a text recognition result of the text included in the initial recognition image.
In one embodiment, the word recognition result includes a target recognition word corresponding to a word included in the initial recognition image and a word recognition probability of the target recognition word, and the word recognition device 100 based on probability calibration further includes:
the first judgment unit is used for judging whether the character recognition probability is greater than or equal to a preset first probability threshold value or not;
the first classification unit is used for classifying the character recognition probability and the target recognition character corresponding to the character recognition probability into a preset high probability sample set if the character recognition probability is greater than or equal to a preset first probability threshold;
and the first extraction unit is used for extracting a preset first number of samples from the preset high probability sample set to serve as high probability samples and displaying the high probability samples so as to enable a user to confirm the high probability samples.
In one embodiment, the text recognition device 100 based on probability calibration further comprises:
the second judging unit is used for judging whether the character recognition probability is smaller than or equal to a preset second probability threshold value or not;
the second classification unit is used for classifying the character recognition probability and the target recognition character corresponding to the character recognition probability into a preset low-probability sample set if the character recognition probability is smaller than or equal to a preset second probability threshold;
and the second extraction unit is used for extracting a preset second number of samples from the preset low probability sample set to serve as low probability samples and displaying the low probability samples so as to enable a user to confirm the low probability samples.
In one embodiment, the text recognition device 100 based on probability calibration further comprises:
a third judging unit configured to judge whether the high probability sample or the low probability sample is modified;
and the first obtaining unit is used for obtaining a modified sample corresponding to the high probability sample or the low probability sample if the high probability sample or the low probability sample is modified, and performing character recognition on the modified sample again.
In one embodiment, the second extraction unit comprises:
the sequencing subunit is configured to sequence all the low-probability samples included in the preset low-probability sample set according to the character recognition probability corresponding to the low-probability sample from small to large to obtain a low-probability sample sequencing queue;
and the extraction subunit is used for extracting a preset second number of samples from the low-probability sample sorting queue as low-probability samples according to the low-probability sample sorting queue and the sequence from small to large.
In one embodiment, the second extraction unit comprises:
the counting subunit is used for counting the number of the low-probability samples contained in the preset low-probability sample set;
a judging subunit, configured to judge whether the number of the low probability samples is less than or equal to the preset second number;
and the obtaining subunit is configured to obtain all low probability samples included in the preset low probability sample set if the number of the low probability samples is less than or equal to the preset second number.
In one embodiment, the text recognition device 100 based on probability calibration further comprises:
and the second acquisition unit is used for acquiring the original image and preprocessing the original image according to a preset preprocessing mode to obtain an initial identification image.
It should be noted that, as can be clearly understood by those skilled in the art, the specific implementation process of the text recognition device and each unit based on probability calibration may refer to the corresponding description in the foregoing method embodiment, and for convenience and brevity of description, no further description is provided herein.
Meanwhile, the division and connection manner of each unit in the character recognition device based on the probability calibration are only used for illustration, in other embodiments, the character recognition device based on the probability calibration may be divided into different units as needed, or each unit in the character recognition device based on the probability calibration may adopt different connection orders and manners, so as to complete all or part of the functions of the character recognition device based on the probability calibration.
The above-mentioned character recognition apparatus based on probability calibration may be implemented in the form of a computer program that can be run on a computer device as shown in fig. 11.
Referring to fig. 11, fig. 11 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 500 may be a computer device such as a desktop computer or a server, or may be a component or part of another device.
Referring to fig. 11, the computer device 500 includes a processor 502, a memory, which may include a non-volatile storage medium 503 and an internal memory 504, which may also be a volatile storage medium, and a network interface 505 connected by a system bus 501.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032, when executed, causes the processor 502 to perform a method of text recognition based on probabilistic calibration as described above.
The processor 502 is used to provide computing and control capabilities to support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 may be enabled to perform a text recognition method based on probability calibration as described above.
The network interface 505 is used for network communication with other devices. Those skilled in the art will appreciate that the configuration shown in fig. 11 is a block diagram of only a portion of the configuration associated with the present application and does not constitute a limitation of the computer device 500 to which the present application may be applied, and that a particular computer device 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components. For example, in some embodiments, the computer device may only include a memory and a processor, and in such embodiments, the structures and functions of the memory and the processor are consistent with those of the embodiment shown in fig. 11, and are not described herein again.
Wherein the processor 502 is configured to run the computer program 5032 stored in the memory to implement the following steps: acquiring an initial identification image, inputting the initial identification image to a preset DARTS model, and performing character identification on the initial identification image to obtain a calibration parameter of characters contained in the initial identification image; inputting the initial recognition image to a preset OCR model, and performing character recognition on the initial recognition image to obtain a character recognition logs probability vector corresponding to characters contained in the initial recognition image; and according to the calibration parameters, carrying out probability calibration on the probability vectors of the character recognition logs and carrying out normalization processing to obtain a character recognition result of characters contained in the initial recognition image.
In an embodiment, after the step of obtaining the character recognition result of the characters included in the initial recognition image by the processor 502 implementing that the character recognition result includes the target recognition characters corresponding to the characters included in the initial recognition image and the character recognition probability of the target recognition characters, the following steps are further implemented:
judging whether the character recognition probability is greater than or equal to a preset first probability threshold value or not;
if the character recognition probability is greater than or equal to a preset first probability threshold value, classifying the character recognition probability and target recognition characters corresponding to the character recognition probability into a preset high probability sample set;
and extracting a preset first number of samples from the preset high probability sample set to serve as high probability samples, and displaying the high probability samples so that a user can confirm the high probability samples.
In an embodiment, after the step of classifying the text recognition probability and the target recognition text corresponding to the text recognition probability into the preset high probability sample set if the text recognition probability is greater than or equal to the preset first probability threshold, the processor 502 further performs the following steps:
judging whether the character recognition probability is smaller than or equal to a preset second probability threshold value or not;
if the character recognition probability is smaller than or equal to a preset second probability threshold value, classifying the character recognition probability and target recognition characters corresponding to the character recognition probability into a preset low probability sample set;
and extracting a preset second number of samples from the preset low probability sample set to serve as low probability samples, and displaying the low probability samples so that a user can confirm the low probability samples.
In an embodiment, after the step of extracting a preset second number of samples from the preset low probability sample set as low probability samples and displaying the low probability samples for the user to confirm the low probability samples, the processor 502 further implements the following steps:
determining whether the high probability sample or the low probability sample is modified;
and if the high probability sample or the low probability sample is modified, obtaining a modified sample corresponding to the high probability sample or the low probability sample, and performing character recognition on the modified sample again.
In an embodiment, when the processor 502 performs the step of extracting a preset second number of samples from the preset low probability sample set as the low probability samples, the following steps are specifically performed:
sequencing all the low-probability samples contained in the preset low-probability sample set according to the character recognition probability corresponding to the low-probability samples from small to large to obtain a low-probability sample sequencing queue;
and according to the low-probability sample sorting queue, extracting a preset second number of samples from the low-probability sample sorting queue as low-probability samples in a sequence from small to large.
In an embodiment, when the processor 502 performs the step of extracting a preset second number of samples from the preset low probability sample set as the low probability samples, the following steps are specifically performed:
counting the number of low-probability samples of the low-probability samples contained in the preset low-probability sample set;
judging whether the number of the low-probability samples is less than or equal to the preset second number;
and if the number of the low probability samples is less than or equal to the preset second number, acquiring all the low probability samples contained in the preset low probability sample set.
In one embodiment, the processor 502 further performs the following steps before performing the step of acquiring the initial identification image:
the method comprises the steps of obtaining an original image, and preprocessing the original image according to a preset preprocessing mode to obtain an initial identification image.
It should be understood that in the embodiment of the present Application, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiments may be implemented by a computer program, and the computer program may be stored in a computer readable storage medium. The computer program is executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present application also provides a computer-readable storage medium. The computer-readable storage medium may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, the computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to perform the steps of:
a computer program product which, when run on a computer, causes the computer to perform the steps of the probabilistic calibration based word recognition method described in the embodiments above.
The computer readable storage medium may be an internal storage unit of the aforementioned device, such as a hard disk or a memory of the device. The computer readable storage medium may also be an external storage device of the device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the device. Further, the computer-readable storage medium may also include both an internal storage unit and an external storage device of the apparatus.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, devices and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The storage medium is an entity and non-transitory storage medium, and may be various entity storage media capable of storing computer programs, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, various elements or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
The steps in the method of the embodiment of the application can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the application can be combined, divided and deleted according to actual needs. In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing an electronic device (which may be a personal computer, a terminal, or a network device) to perform all or part of the steps of the method according to the embodiments of the present application.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the present application, and these modifications or substitutions should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A character recognition method based on probability calibration comprises the following steps:
acquiring an initial identification image, inputting the initial identification image to a preset DARTS model, and performing character identification on the initial identification image to obtain a calibration parameter of characters contained in the initial identification image;
inputting the initial recognition image to a preset OCR model, and performing character recognition on the initial recognition image to obtain a character recognition logs probability vector corresponding to characters contained in the initial recognition image;
and according to the calibration parameters, carrying out probability calibration on the probability vectors of the character recognition logs and carrying out normalization processing to obtain a character recognition result of characters contained in the initial recognition image.
2. The method of claim 1, wherein the text recognition result comprises a target recognition text corresponding to the text included in the initial recognition image and a text recognition probability of the target recognition text, and the step of obtaining the text recognition result of the text included in the initial recognition image further comprises:
judging whether the character recognition probability is greater than or equal to a preset first probability threshold value or not;
if the character recognition probability is greater than or equal to a preset first probability threshold value, classifying the character recognition probability and target recognition characters corresponding to the character recognition probability into a preset high probability sample set;
and extracting a preset first number of samples from the preset high probability sample set to serve as high probability samples, and displaying the high probability samples so that a user can confirm the high probability samples.
3. The method of claim 2, wherein the step of classifying the text recognition probability and the target recognized text corresponding to the text recognition probability into a predetermined high probability sample set if the text recognition probability is greater than or equal to a predetermined first probability threshold further comprises:
judging whether the character recognition probability is smaller than or equal to a preset second probability threshold value or not;
if the character recognition probability is smaller than or equal to a preset second probability threshold value, classifying the character recognition probability and target recognition characters corresponding to the character recognition probability into a preset low probability sample set;
and extracting a preset second number of samples from the preset low probability sample set to serve as low probability samples, and displaying the low probability samples so that a user can confirm the low probability samples.
4. The method for recognizing words based on probability calibration as claimed in claim 3, wherein after the step of extracting a second predetermined number of samples from the set of low probability samples as low probability samples and displaying the low probability samples for the user to confirm the low probability samples, the method further comprises:
determining whether the high probability sample or the low probability sample is modified;
and if the high probability sample or the low probability sample is modified, obtaining a modified sample corresponding to the high probability sample or the low probability sample, and performing character recognition on the modified sample again.
5. The method of claim 3, wherein the step of extracting a second predetermined number of samples from the set of low probability samples as the low probability samples comprises:
sequencing all the low-probability samples contained in the preset low-probability sample set according to the character recognition probability corresponding to the low-probability samples from small to large to obtain a low-probability sample sequencing queue;
and according to the low-probability sample sorting queue, extracting a preset second number of samples from the low-probability sample sorting queue as low-probability samples in a sequence from small to large.
6. The method of claim 3, wherein the step of extracting a second predetermined number of samples from the set of low probability samples as the low probability samples comprises:
counting the number of low-probability samples of the low-probability samples contained in the preset low-probability sample set;
judging whether the number of the low-probability samples is less than or equal to the preset second number;
and if the number of the low probability samples is less than or equal to the preset second number, acquiring all the low probability samples contained in the preset low probability sample set.
7. The method of probability calibration based word recognition according to claim 1, wherein the step of obtaining an initial recognition image is preceded by the steps of:
the method comprises the steps of obtaining an original image, and preprocessing the original image according to a preset preprocessing mode to obtain an initial identification image.
8. A character recognition apparatus based on probability calibration, comprising:
the system comprises a first identification unit, a second identification unit and a third identification unit, wherein the first identification unit is used for acquiring an initial identification image, inputting the initial identification image to a preset DARTS model, and performing character identification on the initial identification image to obtain a calibration parameter of characters contained in the initial identification image;
the second identification unit is used for inputting the initial identification image to a preset OCR model, performing character identification on the initial identification image and obtaining a character identification Logits probabilistic vector corresponding to characters contained in the initial identification image;
and the calibration identification unit is used for carrying out probability calibration on the character recognition logs probability vector according to the calibration parameters and carrying out normalization processing to obtain a character recognition result of characters contained in the initial recognition image.
9. A computer device, comprising a memory and a processor coupled to the memory; the memory is used for storing a computer program; the processor is adapted to run the computer program to perform the steps of the method according to any of claims 1-7.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when being executed by a processor, realizes the steps of the method according to any one of claims 1 to 7.
CN202110735014.8A 2021-06-30 2021-06-30 Character recognition method, device, computer equipment and medium based on probability calibration Active CN113420689B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110735014.8A CN113420689B (en) 2021-06-30 2021-06-30 Character recognition method, device, computer equipment and medium based on probability calibration

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110735014.8A CN113420689B (en) 2021-06-30 2021-06-30 Character recognition method, device, computer equipment and medium based on probability calibration

Publications (2)

Publication Number Publication Date
CN113420689A true CN113420689A (en) 2021-09-21
CN113420689B CN113420689B (en) 2024-03-22

Family

ID=77717310

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110735014.8A Active CN113420689B (en) 2021-06-30 2021-06-30 Character recognition method, device, computer equipment and medium based on probability calibration

Country Status (1)

Country Link
CN (1) CN113420689B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111667066A (en) * 2020-04-23 2020-09-15 北京旷视科技有限公司 Network model training and character recognition method and device and electronic equipment
US20210012199A1 (en) * 2019-07-04 2021-01-14 Zhejiang University Address information feature extraction method based on deep neural network model
CN112329779A (en) * 2020-11-02 2021-02-05 平安科技(深圳)有限公司 Method and related device for improving certificate identification accuracy based on mask

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210012199A1 (en) * 2019-07-04 2021-01-14 Zhejiang University Address information feature extraction method based on deep neural network model
CN111667066A (en) * 2020-04-23 2020-09-15 北京旷视科技有限公司 Network model training and character recognition method and device and electronic equipment
CN112329779A (en) * 2020-11-02 2021-02-05 平安科技(深圳)有限公司 Method and related device for improving certificate identification accuracy based on mask

Also Published As

Publication number Publication date
CN113420689B (en) 2024-03-22

Similar Documents

Publication Publication Date Title
US11816165B2 (en) Identification of fields in documents with neural networks without templates
US8867828B2 (en) Text region detection system and method
CN110647829A (en) Bill text recognition method and system
WO2019051941A1 (en) Method, apparatus and device for identifying vehicle type, and computer-readable storage medium
CN108830329B (en) Picture processing method and device
CN111753863A (en) Image classification method and device, electronic equipment and storage medium
CN106372624B (en) Face recognition method and system
CN111428557A (en) Method and device for automatically checking handwritten signature based on neural network model
CN113221918B (en) Target detection method, training method and device of target detection model
CN114139564B (en) Two-dimensional code detection method and device, terminal equipment and training method of detection network
CN110135428B (en) Image segmentation processing method and device
CN113537192B (en) Image detection method, device, electronic equipment and storage medium
CN111008624A (en) Optical character recognition method and method for generating training sample for optical character recognition
CN113902944A (en) Model training and scene recognition method, device, equipment and medium
CN116167336B (en) Sensor data processing method based on cloud computing, cloud server and medium
CN110210314B (en) Face detection method, device, computer equipment and storage medium
JP2009276937A (en) Dictionary creating apparatus, recognition apparatus, recognition method, and recognition program
US11715288B2 (en) Optical character recognition using specialized confidence functions
CN116311276A (en) Document image correction method, device, electronic equipment and readable medium
CN113420689B (en) Character recognition method, device, computer equipment and medium based on probability calibration
CN112950652B (en) Robot and hand image segmentation method and device thereof
CN116152824A (en) Invoice information extraction method and system
CN112907541B (en) Palm image quality evaluation model construction method and device
CN115620083A (en) Model training method, face image quality evaluation method, device and medium
CN114663899A (en) Financial bill processing method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant