CN110929724A - Character recognition method, character recognition device, computer equipment and storage medium - Google Patents

Character recognition method, character recognition device, computer equipment and storage medium Download PDF

Info

Publication number
CN110929724A
CN110929724A CN201911188179.7A CN201911188179A CN110929724A CN 110929724 A CN110929724 A CN 110929724A CN 201911188179 A CN201911188179 A CN 201911188179A CN 110929724 A CN110929724 A CN 110929724A
Authority
CN
China
Prior art keywords
recognized
character
image
attribute
characters
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.)
Pending
Application number
CN201911188179.7A
Other languages
Chinese (zh)
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.)
Shanghai Eye Control Technology Co Ltd
Original Assignee
Shanghai Eye Control Technology 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 Shanghai Eye Control Technology Co Ltd filed Critical Shanghai Eye Control Technology Co Ltd
Priority to CN201911188179.7A priority Critical patent/CN110929724A/en
Publication of CN110929724A publication Critical patent/CN110929724A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • G06V20/62Text, e.g. of license plates, overlay texts or captions on TV images
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Multimedia (AREA)
  • Character Discrimination (AREA)

Abstract

The present application relates to the field of computer technologies, and in particular, to a character recognition method, apparatus, computer device, and storage medium. The method comprises the following steps: acquiring a character image to be recognized, and extracting image characteristics of the character image to be recognized; dividing the image features into image feature blocks; inputting each image feature block into an attribute prediction model to obtain attribute features corresponding to each image feature block; obtaining a classification result corresponding to the character image to be recognized according to each attribute feature; and acquiring a mapping function, and mapping the classification result according to the mapping function to obtain a character recognition result corresponding to the character image to be recognized. By adopting the method, the capability of the model for identifying the category and the identification efficiency can be improved.

Description

Character recognition method, character recognition device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a character recognition method, apparatus, computer device, and storage medium.
Background
At present, the performance of the model can be improved by training a large amount of data through the convolutional neural network, and the model can be trained through training set data, so that the model can classify the objects of the test set. However, for recognition tasks, such as various types of chinese characters, numbers, letters, and symbols, when there is limited data, when there is no intersection between a model trained using a training set class and a test set class, the class may not be correctly recognized.
In the traditional technology, the network category needs to be changed, and a new model needs to be retrained, so that the new model can identify the category, and the capability of the model for identifying the category and the identification efficiency are low.
Disclosure of Invention
In view of the above, it is necessary to provide a character recognition method, apparatus, computer device and storage medium capable of improving recognition capability in view of the above technical problems.
A character recognition method, comprising:
acquiring a character image to be recognized, and extracting image characteristics of the character image to be recognized;
dividing the image features into image feature blocks;
inputting each image feature block into an attribute prediction model to obtain attribute features corresponding to each image feature block;
obtaining a classification result corresponding to the character image to be recognized according to each attribute feature;
and acquiring a mapping function, and mapping the classification result according to the mapping function to obtain a character recognition result corresponding to the character image to be recognized.
In one embodiment, the obtaining a mapping function to map the classification result according to the mapping function to obtain a character recognition result corresponding to the character image to be recognized includes:
extracting space characters in the classification result;
detecting whether continuous same characters to be processed exist between the adjacent space characters;
when the continuous same characters to be processed exist between the adjacent space characters, performing de-duplication operation on the characters to be processed according to a mapping function, so that the continuous same characters to be processed do not exist between the adjacent space characters;
and taking the characters in the deleted classification result as a character recognition result corresponding to the character image to be recognized.
In one embodiment, the taking the deleted characters in the classification result as the character recognition result corresponding to the character image to be recognized includes:
deleting the space character;
and taking the characters in the classification result after the space characters are deleted as the character recognition result corresponding to the character image to be recognized.
In one embodiment, the obtaining of the classification result corresponding to the character image to be recognized according to each attribute feature includes:
acquiring a mapping relation between each attribute feature and each category, and acquiring semantic codes corresponding to each category according to the mapping relation;
obtaining a classifier according to the semantic code and the attribute characteristics;
and obtaining a classification result corresponding to the character image to be recognized according to the classifier.
In an embodiment, the obtaining, according to the classifier, a classification result corresponding to the character image to be recognized includes:
calculating the similarity between each category in the classification result by using a dot product algorithm;
adjusting classifier parameters according to the numerical value of the similarity until the numerical value of the similarity reaches a preset threshold value, and extracting the adjusted classifier parameters;
obtaining an updated classifier according to the adjusted classifier parameters;
and obtaining a classification result corresponding to the character image to be recognized according to the updated classifier.
In one embodiment, the method for generating the attribute prediction model includes:
acquiring character images to be recognized and attribute characteristics corresponding to the character images to be recognized;
and inputting each character image to be recognized and each attribute feature into a machine learning model so as to learn an attribute prediction parameter through the machine learning model until the value of a loss function corresponding to the model obtained according to the attribute prediction parameter is within a preset range, thereby obtaining the attribute prediction model.
An apparatus for character recognition, the apparatus comprising:
the characteristic extraction module is used for acquiring a character image to be recognized and extracting the image characteristics of the character image to be recognized;
the characteristic block acquisition module is used for dividing the image characteristics into image characteristic blocks;
the attribute feature acquisition module is used for inputting each image feature block into an attribute prediction model to obtain attribute features corresponding to each image feature block;
the classification acquisition module is used for acquiring a classification result corresponding to the character image to be recognized according to each attribute feature;
and the result acquisition module is used for acquiring a mapping function, and mapping the classification result according to the mapping function to obtain a character recognition result corresponding to the character image to be recognized.
In one embodiment, the result obtaining module includes:
the space character extracting unit is used for extracting space characters in the classification result;
the character acquisition unit to be processed is used for detecting whether continuous same characters to be processed exist between the adjacent space characters;
the character detection unit is used for carrying out duplication elimination operation on the characters to be processed according to a mapping function when the continuous same characters to be processed exist between the adjacent space characters, so that the continuous same characters to be processed do not exist between the adjacent space characters;
and the result acquisition unit is used for taking the characters in the deleted classification result as the character recognition result corresponding to the character image to be recognized.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the above method when executing the computer program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method.
The character recognition method, the character recognition device, the computer equipment and the storage medium acquire the character image to be recognized and extract the image characteristics of the character image to be recognized; dividing image features into image feature blocks; inputting each image feature block into an attribute prediction model to obtain attribute features corresponding to each image feature block, not directly performing category recognition on character images to be recognized, but firstly obtaining the attribute features to perform semantic description on the character images to be recognized, then obtaining classification results corresponding to the character images to be recognized according to the attribute features, and recognizing the categories according to the attribute features, so that the model has the migration prediction capability on the categories, and the recognition capability on the categories which do not participate in the classification is realized. And then, a mapping function is obtained, the classification result is mapped according to the mapping relation in the mapping function, a character recognition result corresponding to the character image to be recognized is obtained, the particularity of character recognition is considered, the mapping function is added to carry out mapping processing on the obtained recognition result, a final character recognition result is obtained, and the recognition capability and the recognition efficiency of the model are improved.
Drawings
FIG. 1 is a diagram illustrating an exemplary implementation of a character recognition method;
FIG. 2 is a flow diagram illustrating a method for character recognition in one embodiment;
FIG. 3 is a schematic diagram of an embodiment in which an interim memory network is provided;
FIG. 4 is a flow chart illustrating a character recognition method according to another embodiment;
FIG. 5 is a block diagram showing the structure of a character recognition apparatus according to an embodiment;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The character recognition method provided by the application can be applied to the application environment shown in fig. 1. Wherein a user terminal 102 communicates with a server 104 over a network. The server 104 acquires a character image to be recognized and extracts the image characteristics of the character image to be recognized; dividing image features into image feature blocks; inputting each image feature block into an attribute prediction model to obtain attribute features corresponding to each image feature block; obtaining a classification result corresponding to the character image to be recognized according to each attribute characteristic; and acquiring a mapping function, mapping the classification result according to the mapping function to obtain a character recognition result corresponding to the character image to be recognized, and further sending the character recognition result to the user terminal 102.
The user terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented by an independent server or a server cluster composed of a plurality of servers. When the server 104 is an independent server, a plurality of databases may be deployed in the server 104, and each database may store a specific type of character image to be recognized; when the server 104 is a server cluster composed of a plurality of servers, a database disposed in each server may store a specific type of character image to be recognized.
In one embodiment, as shown in fig. 2, a character recognition method is provided, which is described by taking the method as an example applied to the server 104 in fig. 1, and in other embodiments, the method can also be applied to a terminal, and the method includes the following steps:
step 210, acquiring a character image to be recognized, and extracting image features of the character image to be recognized.
And the server extracts the image characteristics of the character image to be recognized by utilizing a deep learning algorithm. If the character image to be recognized is input into the pre-trained neural network model, the neural network model performs feature extraction on the character image to be recognized according to the pre-trained feature parameters to obtain the image features of the character image to be recognized.
If the residual learning (residual learning) idea is added into the convolutional neural network, the server uses a feature extraction module in front of a full connection layer of the residual neural network (ResNet) to extract the image features of the character image to be recognized, and the problems of gradient dispersion and accuracy reduction in a deep network are solved by using the ResNet to extract the image features, so that the network can be deeper and deeper, the accuracy is guaranteed, and the speed is controlled. In other embodiments, the server may also extract image features by using a VGG network, an Alexnet network, and the like, which is not limited in this application.
Specifically, the ResNet is composed of a plurality of convolution layers, a Batch Normalization-bn layer and a pooling layer, wherein the convolution layers use convolution kernels with different sizes and dimensions for image feature extraction, and the pooling layer can reduce model parameters and increase nonlinearity of a model; the bn layer normalizes data of each batch process (mini-batch) in the network layer to enable the mean value to be 0 and the variance to be 1, so that the phenomena of gradient disappearance and explosion in DNN training are relieved, a large learning rate is allowed to be used, and model convergence is accelerated.
Step 220, divide the image features into image feature blocks.
In order to ensure that the extracted image features can adapt to the next data processing, the server performs preprocessing on the extracted image features, specifically, divides the image features into a plurality of image feature blocks according to a preset rule. If the output of the image feature extraction module is 1024-dimensional image features, the image features are divided into image feature blocks according to a preset width, such as 1, and then each image feature block is sent to a next neural network, such as a Long Short-Term Memory-LSTM (Long Short-Term Memory-LSTM) network, to perform attribute prediction.
Step 230, inputting each image feature block into the attribute prediction model to obtain the attribute feature corresponding to each image feature block.
And the server inputs the preprocessed image features into an attribute prediction model, and the attribute prediction model obtains the attribute features corresponding to the image features according to the relationship between the attributes and the image features learned in advance. Specifically, the server may input the preprocessed image features, such as the image feature blocks, into a neural network, such as an LSTM network, respectively, to obtain attribute features corresponding to the plurality of image feature blocks, respectively. Further, in the process of predicting the attribute features according to the image features, the method may further include calculating a matching probability between each image feature block and each preset attribute, and extracting the preset attribute with the maximum matching probability value as the attribute feature corresponding to the image feature sequence.
Referring to fig. 3, a schematic diagram of the structure of an LSTM network is provided, which consists of a fully connected layer and a softmax layer. Specifically, in the present application, the original global layer is changed into a global layer that can be used for attribute feature prediction, such as an RIS model (registration using independent sessions) that can be independently learned for each attribute. It should be noted that, in other embodiments, other fully-connected layers capable of performing attribute prediction may also be connected in the LSTM, and are not limited herein.
For example, when the model is an RIS model, the corresponding full-connected layer is a 512-dimensional full-connected layer, and the parameter of the layer is 1024 × 512, which is used for predicting the attribute characteristics. It should be noted that, in other embodiments, the size of the network parameter may also be set according to actual needs.
And 240, obtaining a classification result corresponding to the character image to be recognized according to each attribute characteristic.
And changing the full connection layer into an attribute prediction layer in the server, wherein the attribute prediction layer is used for predicting the attribute characteristics of the character. Specifically, the server predicts the corresponding attribute features by using the extracted image features, and then connects a full connection layer for prediction of categories to obtain the classification result corresponding to the character image to be recognized. For example, a fully connected layer connected to a C dimension, where C is the size of the word stock for recognition, e.g., C is 6 in fig. 3, and may be specifically a rule (recognition Using semantic tokens) classification model.
And 250, acquiring a mapping function, and mapping the classification result according to the mapping function to obtain a character recognition result corresponding to the character image to be recognized.
The classification result obtained by the server using the attribute features may not be the final classification result, and the server needs to preprocess the obtained classification result to obtain the final character recognition result. Specifically, a mapping function is set in the server, and the classification result is mapped by using a mapping relation preset in the mapping function, so as to obtain a character recognition result corresponding to the character to be recognized.
For example, the mapping function may be a many-to-one mapping function, so as to find a correct mapping path from a plurality of possible mapping paths, and obtain a mapping from the classification result to the character recognition result according to the correct mapping path, and specifically, the mapping relationship may include processing repeated characters in the classification result, processing space characters, and the like.
In the embodiment, in the process of recognizing characters, attribute features are used for recognition, and since the attribute features are high-level semantic features, even though untrained classes are encountered in the recognition process, the recognition capability of the migration of new classes can be realized, namely zero shot learning-ZSL (zero shot learning) is realized. When certain categories do not exist in the data set, a correct character recognition result can be obtained through the attribute characteristics, and the recognition capability, the recognition efficiency, the recognition universality and the like of the character recognition model are improved.
In one embodiment, obtaining a mapping function to map the classification result according to the mapping function to obtain a character recognition result corresponding to the character image to be recognized includes: extracting space characters in the classification result; detecting whether continuous same characters to be processed exist between adjacent space characters; when continuous identical characters to be processed exist between adjacent space characters, performing duplication elimination operation on the characters to be processed according to a mapping function, so that the continuous identical characters to be processed do not exist between the adjacent space characters; and taking the characters in the deleted classification result as a character recognition result corresponding to the character image to be recognized.
Specifically, the server inputs the obtained Classification result into a connection timing Classification-CTC (ConnectionistTemporal Classification-CTC), and maps the Classification result according to the CTC to obtain a final character recognition result.
Specifically, the server extracts the space characters in the classification result, detects whether continuous same characters to be processed exist between adjacent space characters, and when the continuous same characters exist, indicates that an identification result which is not an expected repeated character exists in the identification result, at this time, the server performs a deduplication operation on the characters to be processed according to a mapping function, only one character is reserved, so that the continuous same characters to be processed do not exist between the adjacent space characters, the classification result is preprocessed, and a character identification result is obtained.
If the character to be recognized is actually an A set, the recognition result recognized according to the attribute features is an A1 set, wherein A is a subset of A1, and in order to map the recognition result A1 to the correct A character, the characters which are not expected in A1 need to be removed by using a mapping function so as to be correctly mapped to the A set. Specifically, assuming that the output result in the a1 set is a1(T), and T is the length of the recognition result, since a1(T) is mapped to a (< ═ T), but in actual situations, the final mapping has only one recognition result, and by using the many-to-one mapping relationship in the mapping function, the matching to the correct mapping path from the multiple path mapping is realized, and further, the character recognition result is obtained. If the mapping function is F, the function mapping relationship is to remove the repeated elements between space characters ' - ' and ' -, so that mapping of a (T) — > a (< ═ T) is implemented according to the mapping relationship, that is, F (a-AB-) ═ F (-AA-ABB-) ═ AAB-.
In the embodiment, by defining the mapping function, the correct mapping of the character recognition result is realized according to the mapping relation set in the mapping function, and the efficiency of character recognition is improved.
In one embodiment, taking the characters in the deleted classification result as the character recognition result corresponding to the character image to be recognized includes: deleting space characters; and taking the characters in the classification result after the space characters are deleted as the character recognition result corresponding to the character image to be recognized.
The space character can be used for segmenting the character but is not a desired character in the character recognition result, and specifically, after the server performs the duplication elimination operation of the space character front and back connection characters according to the mapping function, the method further comprises deleting the detected space character, and then generating the character recognition result according to the duplication elimination operation and the characters left after the space character is deleted. If the character recognition results left after the duplication removing operation and the space character removing according to the mapping function are as follows: f (a-AB-) ═ F (-AA-ABB-) -, i.e., after the space character '-' is removed, the final prediction result is AAB regardless of whether the neural network prediction result is '-a-AB' or '-AA-ABB-'.
As shown in fig. 4, a schematic flow chart of a character recognition method in another embodiment is provided, which includes:
and step 410, acquiring a character image to be recognized, and extracting the image characteristics of the character image to be recognized by using an LSTM network.
Specifically, see step 210 for a description of a specific embodiment of this step.
In step 420, the image features are divided into image feature blocks.
Specifically, see step 220 for a description of a specific embodiment of this step.
And step 430, inputting each image feature block into the RIS attribute prediction model to obtain the attribute features corresponding to each image feature block.
Specifically, see step 230 for a description of a specific embodiment of this step.
And step 440, the RULE network obtains a classification result corresponding to the character image to be recognized according to each attribute feature.
Specifically, see step 240 for a description of a specific embodiment of this step.
And step 450, inputting the classification result into the CTC layer to obtain a corresponding character recognition result.
Specifically, for a description of a specific embodiment of step 450, refer to the description above for the mapping function embodiment.
If the content of the character image to be recognized is cat characters, an image feature map (feature map) of the character image to be recognized is obtained through step 410, then attribute features corresponding to the character image to be recognized are obtained through step 420, and each attribute feature corresponds to one Classification result, even if the content of an untrained image is an image of cat characters in advance, a correct Classification result can be obtained through extracting the attribute features of the character image to be recognized, if the Classification result obtained according to the attribute features is in various forms such as c-aa-t, ccc-aa-tt and the like, wherein the Classification result represents a space character blanks, the recognition result is input into a connection timing Classification (Connectionist Temporal Classification-CTC) layer, content of middle repetition of the blanks and the blanks are deleted, and a final recognition result cat is obtained.
In this embodiment, the mapping function is used to further process the obtained recognition result, so as to obtain a final character recognition result, thereby achieving an effect of accurately obtaining the character recognition result.
In one embodiment, obtaining a classification result corresponding to the character image to be recognized according to each attribute feature includes: acquiring the mapping relation between each attribute characteristic and each category, and acquiring semantic codes corresponding to each category according to the mapping relation; obtaining a classifier according to the semantic code and the attribute characteristics; and obtaining a classification result corresponding to the character image to be recognized according to the classifier.
Specifically, assuming that there are Q attribute features, represented by the binary values 1 and-1, and there are C categories, each category is converted into a form of one-hot encoding (one-hot), as in equation (1):
Figure BDA0002292922280000091
equation (1) is a mapping relationship between category y and attribute feature k, specifically, if category y includes attribute k, then φk(y) has a value of 1, and if the category y does not contain the attribute k, then φkThe value of (y) is-1, and equation (1) is referred to as semantic code for category y.
The classifier obtained according to formula (1) is shown in formula (2), and specifically, the classifier can be defined as:
h(x;T,Θ)=ΦTa(x)=ΦTTTθ(x;Θ) (2)
wherein, theta (x; theta) represents the image characteristic corresponding to the input character image to be recognized, and T is the imageRadial matrix, phiTThe one-hot representation of the presentation category,
Figure BDA0002292922280000101
if the target function in the formula (2) is realized by using the neural network structure, only the image features of the character image to be recognized need to be extracted by using the CNN, the image features are mapped into a semantic space (namely, a mapping matrix T is learned) through a full connection layer, the output is in a form of a category y, and the loss function can adopt cross entropy loss between network output and a real sample.
Specifically, the training process of the classifier comprises the following steps: given training set
Figure BDA0002292922280000102
Wherein, y(i)Is a training character image x(i)The model parameters are updated by adopting the cross entropy loss between the class of the network output and the real label, as shown in formula (3) and formula (4):
R[h,D]=∑iL(h(x(i);T,Θ),y(i)) (3)
L(v,y)=-log(ρy(v)) (4)
wherein, formula (3) is a calculation formula of the loss function, v in formula (4) represents the network output, and y represents the real label.
In the embodiment, the classification model is trained in advance, so that the trained model can be directly utilized to classify the image to be recognized in the character recognition process, and the character recognition efficiency is improved.
In one embodiment, obtaining a classification result corresponding to the character image to be recognized according to the classifier includes: calculating the similarity among all classes in the classification result by using a dot product algorithm, adjusting classifier parameters according to the numerical value of the similarity, and extracting the adjusted classifier parameters until the numerical value of the similarity reaches a preset threshold value; obtaining an updated classifier according to the adjusted classifier parameters; and obtaining a classification result corresponding to the character image to be recognized according to the updated classifier.
Specifically, when the numerical value of the similarity meets a preset threshold condition, the parameter of the classifier is judged to be the optimal parameter, and the classifier is updated according to the optimal parameter to obtain the updated classifier. The optimal parameter is the most accurate category predicted by the classifier obtained according to the parameter, so that the updated classifier is used for performing category identification on the character image to be identified, and the accuracy of character identification is improved.
In this embodiment, a dot product (dot product) algorithm is used to measure the similarity between different classes, and the similarity calculation is used to assist the loss function, update the parameters of the model, and increase the generalization capability of the model. And according to the class information of the training set, the classification loss learning parameter T is used, so that the constraint is relaxed, and the generalization capability of the model on the test set is increased.
In one embodiment, a method for generating an attribute prediction model includes: acquiring character images to be recognized and attribute characteristics corresponding to the character images to be recognized; and inputting each character image to be recognized and each attribute feature into the machine learning model so as to learn the attribute prediction parameters through the machine learning model until the value of the loss function corresponding to the model obtained according to the attribute prediction parameters is within a preset range, thereby obtaining the attribute prediction model.
The RIS model is a pre-trained attribute prediction model, specifically, the mapping W of the RIS learning sample x to the attribute vector s, and a training set is set as follows:
Figure BDA0002292922280000111
where x is the input sample and the attribute set is
Figure BDA0002292922280000112
For Q attributes, a CNN is established for each attribute as an attribute classifier:
Figure BDA0002292922280000113
wherein, σ is a sigmoid function, and the loss function is a cross entropy loss function. t is tkIs a parameter vector, tkAnd the parameter Θ can be obtained by minimizing equation (7):
Figure BDA0002292922280000114
Lb(v,y)=-ylog(v)-(1-y)log(1-v) (8)
wherein y is a label and v is a prediction result.
And then obtaining an attribute prediction model according to the training result.
In the embodiment, the attribute prediction model is trained in advance, so that the trained model can be directly used for predicting the attribute in the process of carrying out character recognition on the image to be recognized, and the character recognition efficiency is improved.
It should be understood that although the various steps in the flow charts of fig. 2-4 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-4 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 5, there is provided a character recognition apparatus including: an apparatus for character recognition, the apparatus comprising:
the feature extraction module 510 is configured to obtain a character image to be recognized, and extract an image feature of the character image to be recognized.
A feature block obtaining module 520, configured to divide the image features into image feature blocks.
An attribute feature obtaining module 530, configured to input each image feature block into an attribute prediction model, so as to obtain an attribute feature corresponding to each image feature block.
And the classification obtaining module 540 is configured to obtain a classification result corresponding to the character image to be recognized according to each attribute feature.
And a result obtaining module 550, configured to obtain a mapping function, and map the classification result according to the mapping function to obtain a character recognition result corresponding to the character image to be recognized.
In one embodiment, the result obtaining module includes:
and the space character extracting unit is used for extracting the space characters in the classification result.
And the character to be processed acquiring unit is used for detecting whether continuous same characters to be processed exist between the adjacent space characters.
And the character detection unit is used for carrying out duplication elimination operation on the characters to be processed according to a mapping function when the continuous same characters to be processed exist between the adjacent space characters, so that the continuous same characters to be processed do not exist between the adjacent space characters.
And the result acquisition unit is used for taking the characters in the deleted classification result as the character recognition result corresponding to the character image to be recognized.
In one embodiment, the result obtaining unit includes:
and the deleting subunit is used for deleting the space character.
And the result acquisition subunit is used for taking the characters in the classification result after the space characters are deleted as the character recognition result corresponding to the character image to be recognized.
In one embodiment, the classification obtaining module 540 includes:
and the code acquisition unit is used for acquiring the mapping relation between each attribute characteristic and each category and acquiring the semantic code corresponding to each category according to the mapping relation.
And the classifier obtaining unit is used for obtaining a classifier according to the semantic code and the attribute characteristics.
And the classification result acquisition unit is used for acquiring a classification result corresponding to the character image to be recognized according to the classifier.
In one embodiment, the classification result obtaining unit includes:
the similarity calculation operator unit is used for calculating the similarity among all classes in the classification result by using a dot product algorithm, and adjusting the classifier parameters according to the numerical value of the similarity until the numerical value of the similarity reaches a preset threshold value, and extracting the adjusted classifier parameters; .
And the updating subunit is used for obtaining an updated classifier according to the adjusted classifier parameters.
And the updating result obtaining subunit is used for obtaining the classification result corresponding to the character image to be recognized according to the updated classifier.
In one embodiment, the apparatus further comprises:
and the corresponding attribute acquisition module is used for acquiring the character images to be recognized and the attribute characteristics corresponding to the character images to be recognized.
And the attribute model acquisition module is used for inputting each character image to be recognized and each attribute feature into a machine learning model so as to learn an attribute prediction parameter through the machine learning model until the value of a loss function corresponding to the model obtained according to the attribute prediction parameter is within a preset range, so as to obtain the attribute prediction model.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for acquiring relevant data of the character image. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a character recognition method.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, there is provided a computer device comprising a memory storing a computer program and a processor implementing the following steps when the processor executes the computer program: a character recognition method, comprising: acquiring a character image to be recognized, and extracting image characteristics of the character image to be recognized; dividing the image features into image feature blocks; inputting each image feature block into an attribute prediction model to obtain attribute features corresponding to each image feature block; obtaining a classification result corresponding to the character image to be recognized according to each attribute feature; and acquiring a mapping function, and mapping the classification result according to the mapping function to obtain a character recognition result corresponding to the character image to be recognized.
In one embodiment, the step of implementing the obtaining of the mapping function when the processor executes the computer program to map the classification result according to the mapping function to obtain the character recognition result corresponding to the character image to be recognized is further configured to: extracting space characters in the classification result; detecting whether continuous same characters to be processed exist between the adjacent space characters; when the continuous same characters to be processed exist between the adjacent space characters, performing de-duplication operation on the characters to be processed according to a mapping function, so that the continuous same characters to be processed do not exist between the adjacent space characters; and taking the characters in the deleted classification result as a character recognition result corresponding to the character image to be recognized.
In one embodiment, the processor, when executing the computer program, is further configured to: deleting the space character; and taking the characters in the classification result after the space characters are deleted as the character recognition result corresponding to the character image to be recognized.
In one embodiment, when the processor executes the computer program, the step of obtaining the classification result corresponding to the character image to be recognized according to each attribute feature is further configured to: acquiring a mapping relation between each attribute feature and each category, and acquiring semantic codes corresponding to each category according to the mapping relation; obtaining a classifier according to the semantic code and the attribute characteristics; and obtaining a classification result corresponding to the character image to be recognized according to the classifier.
In one embodiment, when the processor executes the computer program, the step of obtaining the classification result corresponding to the character image to be recognized according to the classifier is further performed by: calculating the similarity among all classes in a classification result by using a dot product algorithm, adjusting classifier parameters according to the numerical value of the similarity, and extracting the adjusted classifier parameters until the numerical value of the similarity reaches a preset threshold value; obtaining an updated classifier according to the adjusted classifier parameters; and obtaining a classification result corresponding to the character image to be recognized according to the updated classifier.
In one embodiment, the steps of the method for generating the property prediction model when the processor executes the computer program are further configured to: acquiring character images to be recognized and attribute characteristics corresponding to the character images to be recognized; and inputting each character image to be recognized and each attribute feature into a machine learning model so as to learn an attribute prediction parameter through the machine learning model until the value of a loss function corresponding to the model obtained according to the attribute prediction parameter is within a preset range, thereby obtaining the attribute prediction model.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: a character recognition method, comprising: acquiring a character image to be recognized, and extracting image characteristics of the character image to be recognized; dividing the image features into image feature blocks; inputting each image feature block into an attribute prediction model to obtain attribute features corresponding to each image feature block; obtaining a classification result corresponding to the character image to be recognized according to each attribute feature; and acquiring a mapping function, and mapping the classification result according to the mapping function to obtain a character recognition result corresponding to the character image to be recognized.
In an embodiment, when being executed by a processor, a computer program implements the obtaining of the mapping function, so as to map the classification result according to the mapping function, and when the step of obtaining the character recognition result corresponding to the character image to be recognized is further used for: extracting space characters in the classification result; detecting whether continuous same characters to be processed exist between the adjacent space characters; when the continuous same characters to be processed exist between the adjacent space characters, performing de-duplication operation on the characters to be processed according to a mapping function, so that the continuous same characters to be processed do not exist between the adjacent space characters; and taking the characters in the deleted classification result as a character recognition result corresponding to the character image to be recognized.
In one embodiment, when being executed by a processor, the computer program further performs the step of using the deleted characters in the classification result as the character recognition result corresponding to the character image to be recognized, and is further configured to: deleting the space character; and taking the characters in the classification result after the space characters are deleted as the character recognition result corresponding to the character image to be recognized.
In one embodiment, when being executed by a processor, the computer program further performs the step of obtaining the classification result corresponding to the character image to be recognized according to each attribute feature, and is further configured to: acquiring a mapping relation between each attribute feature and each category, and acquiring semantic codes corresponding to each category according to the mapping relation; obtaining a classifier according to the semantic code and the attribute characteristics; and obtaining a classification result corresponding to the character image to be recognized according to the classifier.
In one embodiment, when being executed by a processor, the computer program further performs the step of obtaining the classification result corresponding to the character image to be recognized according to the classifier by: calculating the similarity among all classes in a classification result by using a dot product algorithm, adjusting classifier parameters according to the numerical value of the similarity, and extracting the adjusted classifier parameters until the numerical value of the similarity reaches a preset threshold value; obtaining an updated classifier according to the adjusted classifier parameters; and obtaining a classification result corresponding to the character image to be recognized according to the updated classifier.
In one embodiment, the computer program when being executed by the processor performs the steps of the method for generating a property prediction model further for: acquiring character images to be recognized and attribute characteristics corresponding to the character images to be recognized; and inputting each character image to be recognized and each attribute feature into a machine learning model so as to learn an attribute prediction parameter through the machine learning model until the value of a loss function corresponding to the model obtained according to the attribute prediction parameter is within a preset range, thereby obtaining the attribute prediction model.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of character recognition, the method comprising:
acquiring a character image to be recognized, and extracting image characteristics of the character image to be recognized;
dividing the image features into image feature blocks;
inputting each image feature block into an attribute prediction model to obtain attribute features corresponding to each image feature block;
obtaining a classification result corresponding to the character image to be recognized according to each attribute feature;
and acquiring a mapping function, and mapping the classification result according to the mapping function to obtain a character recognition result corresponding to the character image to be recognized.
2. The method according to claim 1, wherein the obtaining a mapping function, and mapping the classification result according to the mapping function to obtain a character recognition result corresponding to the character image to be recognized comprises:
extracting space characters in the classification result;
detecting whether continuous same characters to be processed exist between the adjacent space characters;
when the continuous same characters to be processed exist between the adjacent space characters, performing de-duplication operation on the characters to be processed according to a mapping function, so that the continuous same characters to be processed do not exist between the adjacent space characters;
and taking the characters in the deleted classification result as a character recognition result corresponding to the character image to be recognized.
3. The method according to claim 2, wherein the step of using the deleted characters in the classification result as the character recognition result corresponding to the character image to be recognized comprises:
deleting the space character;
and taking the characters in the classification result after the space characters are deleted as the character recognition result corresponding to the character image to be recognized.
4. The method according to claim 1, wherein the obtaining of the classification result corresponding to the character image to be recognized according to each of the attribute features comprises:
acquiring a mapping relation between each attribute feature and each category, and acquiring semantic codes corresponding to each category according to the mapping relation;
obtaining a classifier according to the semantic code and the attribute characteristics;
and obtaining a classification result corresponding to the character image to be recognized according to the classifier.
5. The method according to claim 4, wherein the obtaining of the classification result corresponding to the character image to be recognized according to the classifier comprises:
calculating the similarity between each category in the classification result by using a dot product algorithm;
adjusting classifier parameters according to the numerical value of the similarity until the numerical value of the similarity reaches a preset threshold value, and extracting the adjusted classifier parameters;
obtaining an updated classifier according to the adjusted classifier parameters;
and obtaining a classification result corresponding to the character image to be recognized according to the updated classifier.
6. The method of claim 1, wherein the generating of the attribute prediction model comprises:
acquiring character images to be recognized and attribute characteristics corresponding to the character images to be recognized;
and inputting each character image to be recognized and each attribute feature into a machine learning model so as to learn an attribute prediction parameter through the machine learning model until the value of a loss function corresponding to the model obtained according to the attribute prediction parameter is within a preset range, thereby obtaining the attribute prediction model.
7. An apparatus for character recognition, the apparatus comprising:
the characteristic extraction module is used for acquiring a character image to be recognized and extracting the image characteristics of the character image to be recognized;
the characteristic block acquisition module is used for dividing the image characteristics into image characteristic blocks;
the attribute feature acquisition module is used for inputting each image feature block into an attribute prediction model to obtain attribute features corresponding to each image feature block;
the classification acquisition module is used for acquiring a classification result corresponding to the character image to be recognized according to each attribute feature;
and the result acquisition module is used for acquiring a mapping function, and mapping the classification result according to the mapping function to obtain a character recognition result corresponding to the character image to be recognized.
8. The module of claim 7, wherein the result obtaining module comprises:
the space character extracting unit is used for extracting space characters in the classification result;
the character acquisition unit to be processed is used for detecting whether continuous same characters to be processed exist between the adjacent space characters;
the character detection unit is used for carrying out duplication elimination operation on the characters to be processed according to a mapping function when the continuous same characters to be processed exist between the adjacent space characters, so that the continuous same characters to be processed do not exist between the adjacent space characters;
and the result acquisition unit is used for taking the characters in the deleted classification result as the character recognition result corresponding to the character image to be recognized.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
CN201911188179.7A 2019-11-28 2019-11-28 Character recognition method, character recognition device, computer equipment and storage medium Pending CN110929724A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911188179.7A CN110929724A (en) 2019-11-28 2019-11-28 Character recognition method, character recognition device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911188179.7A CN110929724A (en) 2019-11-28 2019-11-28 Character recognition method, character recognition device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110929724A true CN110929724A (en) 2020-03-27

Family

ID=69847379

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911188179.7A Pending CN110929724A (en) 2019-11-28 2019-11-28 Character recognition method, character recognition device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110929724A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112364933A (en) * 2020-11-23 2021-02-12 北京达佳互联信息技术有限公司 Image classification method and device, electronic equipment and storage medium
CN113076554A (en) * 2021-03-12 2021-07-06 广西东信易联科技有限公司 Physical examination data safe storage method based on block chain
CN113591916A (en) * 2021-06-29 2021-11-02 北京旷视科技有限公司 Data processing method and device based on two-classification model

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108537115A (en) * 2018-03-02 2018-09-14 阿里巴巴集团控股有限公司 Image-recognizing method, device and electronic equipment
JP2019079347A (en) * 2017-10-25 2019-05-23 ネットスマイル株式会社 Character estimation system, character estimation method, and character estimation program
CN110020615A (en) * 2019-03-20 2019-07-16 阿里巴巴集团控股有限公司 The method and system of Word Input and content recognition is carried out to picture
CN110046250A (en) * 2019-03-17 2019-07-23 华南师范大学 Three embedded convolutional neural networks model and its more classification methods of text
CN110414520A (en) * 2019-06-28 2019-11-05 平安科技(深圳)有限公司 Universal character recognition methods, device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2019079347A (en) * 2017-10-25 2019-05-23 ネットスマイル株式会社 Character estimation system, character estimation method, and character estimation program
CN108537115A (en) * 2018-03-02 2018-09-14 阿里巴巴集团控股有限公司 Image-recognizing method, device and electronic equipment
CN110046250A (en) * 2019-03-17 2019-07-23 华南师范大学 Three embedded convolutional neural networks model and its more classification methods of text
CN110020615A (en) * 2019-03-20 2019-07-16 阿里巴巴集团控股有限公司 The method and system of Word Input and content recognition is carried out to picture
CN110414520A (en) * 2019-06-28 2019-11-05 平安科技(深圳)有限公司 Universal character recognition methods, device, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
KAI CHEN等: "《A Compact CNN-DBLSTM Based Character Model For Online Handwritten Chinese Text Recognition》", pages 1068 - 1073 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112364933A (en) * 2020-11-23 2021-02-12 北京达佳互联信息技术有限公司 Image classification method and device, electronic equipment and storage medium
CN113076554A (en) * 2021-03-12 2021-07-06 广西东信易联科技有限公司 Physical examination data safe storage method based on block chain
CN113076554B (en) * 2021-03-12 2022-10-11 广西东信易联科技有限公司 Physical examination data safe storage method based on block chain
CN113591916A (en) * 2021-06-29 2021-11-02 北京旷视科技有限公司 Data processing method and device based on two-classification model

Similar Documents

Publication Publication Date Title
US10963637B2 (en) Keyword extraction method, computer equipment and storage medium
CN110598206B (en) Text semantic recognition method and device, computer equipment and storage medium
WO2020015076A1 (en) Facial image comparison method and apparatus, computer device, and storage medium
WO2021169111A1 (en) Resume screening method and apparatus, computer device and storage medium
US10963685B2 (en) Generating variations of a known shred
CN110569500A (en) Text semantic recognition method and device, computer equipment and storage medium
CN110866140A (en) Image feature extraction model training method, image searching method and computer equipment
CN113033249A (en) Character recognition method, device, terminal and computer storage medium thereof
EP2806374B1 (en) Method and system for automatic selection of one or more image processing algorithm
US20170076152A1 (en) Determining a text string based on visual features of a shred
CN110929724A (en) Character recognition method, character recognition device, computer equipment and storage medium
CN110705489B (en) Training method and device for target recognition network, computer equipment and storage medium
CN113486175B (en) Text classification method, text classification device, computer device, and storage medium
CN112819023A (en) Sample set acquisition method and device, computer equipment and storage medium
CN114549913B (en) Semantic segmentation method and device, computer equipment and storage medium
CN113610787A (en) Training method and device of image defect detection model and computer equipment
CN113505797B (en) Model training method and device, computer equipment and storage medium
CN113496277A (en) Neural network device for retrieving image and operation method thereof
CN111611413B (en) Deep hashing method based on metric learning
WO2022035942A1 (en) Systems and methods for machine learning-based document classification
CN109101984B (en) Image identification method and device based on convolutional neural network
CN111783088A (en) Malicious code family clustering method and device and computer equipment
Liu et al. Multi-digit Recognition with Convolutional Neural Network and Long Short-term Memory
CN113468322A (en) Method, device, equipment and medium for training and extracting keyword recognition model
CN114077685A (en) Image retrieval method and device, computer equipment and storage 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
AD01 Patent right deemed abandoned
AD01 Patent right deemed abandoned

Effective date of abandoning: 20240326