CN114973276A - Handwritten character detection method and device and electronic equipment - Google Patents
Handwritten character detection method and device and electronic equipment Download PDFInfo
- Publication number
- CN114973276A CN114973276A CN202210777009.8A CN202210777009A CN114973276A CN 114973276 A CN114973276 A CN 114973276A CN 202210777009 A CN202210777009 A CN 202210777009A CN 114973276 A CN114973276 A CN 114973276A
- Authority
- CN
- China
- Prior art keywords
- character
- image
- handwritten
- character set
- determining
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/22—Character recognition characterised by the type of writing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Software Systems (AREA)
- Computing Systems (AREA)
- Biomedical Technology (AREA)
- Molecular Biology (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Computational Linguistics (AREA)
- Mathematical Physics (AREA)
- Biophysics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Multimedia (AREA)
- Databases & Information Systems (AREA)
- Medical Informatics (AREA)
- Character Discrimination (AREA)
Abstract
The utility model provides a handwritten character detection method, a device and an electronic device, belonging to the technical field of text recognition, wherein, the method comprises the following steps: acquiring a first image comprising a single handwritten word; performing text recognition on the first image to obtain a first character set and a confidence coefficient of each character in the first character set; under the condition that the maximum confidence coefficient in a first character set is greater than a false confidence coefficient threshold and less than a true confidence coefficient threshold, matching a first image with a second image associated with each character in the first character set to obtain an image matching result, wherein each character in the first character set is associated with an image of at least one handwritten word; and determining the detection result of the handwritten character according to the image matching result. By adopting the method and the device, the handwritten character detection can be realized.
Description
Technical Field
The present disclosure relates to the field of text recognition technologies, and in particular, to a handwritten character detection method and apparatus, and an electronic device.
Background
In the handwriting scene, the written content is possibly wrong and very off-spectrum, and may not be a normal character, which is called as 'wrong character' in daily life. In the related art, no solution for detecting handwritten characters is found.
In OCR (Optical Character Recognition) scenes, the problem has been ignored because the goal in most scenes is to recognize symbols more accurately, rather than to solve the problem that recognized image information is written with erroneous words.
In summary, there is currently no effective solution for detecting handwritten words.
Disclosure of Invention
According to an aspect of the present disclosure, there is provided a handwritten word detection method including:
acquiring a first image comprising a single handwritten word;
performing text recognition on the first image to obtain a first character set and a confidence coefficient of each character in the first character set;
under the condition that the maximum confidence coefficient in the first character set is greater than a false confidence coefficient threshold and less than a true confidence coefficient threshold, matching the first image with a second image associated with each character in the first character set to obtain an image matching result, wherein each character in the first character set is associated with an image of at least one handwritten word;
and determining the detection result of the handwritten character according to the image matching result.
According to an aspect of the present disclosure, there is provided a handwritten word detection apparatus including:
an acquisition module for acquiring a first image comprising a single handwritten word;
the recognition module is used for performing text recognition on the first image to obtain a first character set and a confidence coefficient of each character in the first character set;
the matching module is used for matching the first image with a second image associated with each character in the first character set under the condition that the maximum confidence coefficient in the first character set is greater than a false confidence coefficient threshold and less than a true confidence coefficient threshold to obtain an image matching result, wherein each character in the first character set is associated with an image of at least one handwritten word;
and the determining module is used for determining the detection result of the handwritten character according to the image matching result.
According to still another aspect of the present disclosure, there is provided an electronic device including:
a processor; and
a memory for storing a program, wherein the program is stored in the memory,
wherein the program comprises instructions which, when executed by the processor, cause the processor to perform the method of the present disclosure.
According to yet another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of the present disclosure.
One or more technical solutions provided in the embodiments of the present disclosure may implement handwritten word detection based on text recognition and image comparison.
Drawings
Further details, features and advantages of the disclosure are disclosed in the following description of exemplary embodiments, taken in conjunction with the accompanying drawings, in which:
FIG. 1 shows a flow chart of a method of handwritten word detection according to an example embodiment of the present disclosure;
FIG. 2 shows a schematic diagram of an image including a single handwritten word;
FIG. 3 is a schematic diagram showing an image of a character-associated handwritten word;
FIG. 4 is a schematic diagram illustrating a graph difference process between an image of a handwritten word and an image of a character-associated handwritten word;
FIG. 5 illustrates another flow chart of a method of handwritten word detection in accordance with an exemplary embodiment of the present disclosure;
FIG. 6 shows a schematic block diagram of a handwritten word detection process in accordance with an example embodiment of the present disclosure;
FIG. 7 shows a schematic block diagram of a faulty word detection process according to an example embodiment of the present disclosure;
FIG. 8 shows a schematic block diagram of an image comparison process according to an exemplary embodiment of the present disclosure;
FIG. 9 shows a schematic block diagram of a handwritten word detection apparatus according to an exemplary embodiment of the present disclosure;
FIG. 10 illustrates a block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and the embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description. It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Aspects of the present disclosure are described below with reference to the accompanying drawings.
Fig. 1 illustrates a flowchart of a handwritten word detection method according to an exemplary embodiment of the present disclosure, which includes steps S101 to S104, as illustrated in fig. 1.
In step S101, a first image including a single handwritten word is acquired.
In the present embodiment, the first image including a single handwritten word may be extracted from an image including a plurality of characters.
In this embodiment, the image of a single handwritten word may be extracted from the text image by various methods, for example, the image of the handwritten word is obtained from the text image based on text detection, further file detection based on semantic segmentation, and the like. This embodiment is not limited to this.
In this embodiment, the handwritten characters may be Chinese, English letters, numbers, and the like. Taking chinese as an example, an example of a first image including a single handwritten word is shown in fig. 2, where the image includes a text portion (also referred to as a writing portion), i.e., where "text" is located, and a background portion (a portion other than the writing), i.e., a white area other than where "text" is located.
Step S102, text recognition is carried out on the first image, and a first character set and the confidence coefficient of each character in the first character set are obtained.
In this embodiment, the text recognition may be performed on the first image by using multiple methods, and the text recognition method is not limited in this embodiment.
In the present embodiment, a false confidence threshold and a true confidence threshold are set. In a case where the confidence of a character in the first character set is less than or equal to the false value confidence threshold, the character on the first image is not the character in the first character set. In the event that the confidence level of a character in the first character set is greater than or equal to the true confidence threshold, the character on the first image is the character in the first character set. If the maximum confidence in the first character set is greater than the false confidence threshold and less than the true confidence threshold, the process proceeds to step S103 for further processing.
Step S103, matching the first image with a second image associated with each character in the first character set under the condition that the maximum confidence in the first character set is greater than the false confidence threshold and less than the true confidence threshold, so as to obtain an image matching result.
Wherein each character in the first set of characters is associated with an image of at least one handwritten word thereof.
In the present embodiment, images of at least one handwritten word per character are collected in advance, and an association relationship between the character and the image of at least one handwritten word is formed. The image (second image) with which the characters are associated can be obtained from the association relationship of the characters and the image of at least one handwritten word thereof.
An image of the character-associated handwritten word is shown in fig. 3. The characters "six", "big", "too" are taken as examples in fig. 3, wherein the character "six" is associated with images of three different handwritten words, see the right side of "six" in fig. 3; the character "big" associates the images of two different handwritten words, see the right side of "big" in FIG. 3; the character "too" is associated with images of three different handwritten words, see the right side of "too" in fig. 3.
In some embodiments, a character meeting a preset condition is selected from the first character set, and the preset condition includes: the confidence is greater than a preset threshold and/or the confidence is ranked on a previous preset name, wherein the preset threshold is greater than a false confidence threshold and less than a true confidence threshold. In step S103, the first image is matched with the second image associated with each selected character. And for the situation that the first character set is larger, setting a preset threshold value for further selection, and excluding characters with the confidence coefficient smaller than or equal to the preset threshold value in the first character set from candidate characters on the first graph, so as to reduce the calculation amount for subsequent processing.
As a possible implementation, matching the first image with the second image associated with each character in the first character set to obtain an image matching result includes:
performing image difference processing between the first image and each second image associated with each character in the first character set to obtain a difference image between the first image and each second image associated with each character in the first character set;
and processing each difference image by using a pre-trained neural network model to obtain an image matching result of each second image associated with each character in the first character set and the first image.
Wherein the pre-trained neural network model may comprise a convolutional neural network. The present embodiment does not limit the neural network model.
The purpose of the map difference processing is to highlight the difference between the two images. For the images of the handwritten characters, if the handwriting is consistent, the same positions on the two images are the same parts, that is, the same image areas are both character parts or are both background parts except the characters.
As an example, in order to make the neural network model focus on the writing difference, the graph difference processing is performed between the first image and each second image associated with each character in the first character set, and the graph difference processing includes: and for each pixel position on the first image, determining the corresponding pixel position on the difference image as a first value under the condition that the corresponding pixel position on each second image is different from the corresponding pixel position on each first image, wherein the first image and the second image are divided into a text part and a background part.
Further, for each pixel position on the first image, under the condition that the pixel position is the same as the corresponding pixel position on the second image and is a character part, determining that the corresponding pixel position on the difference image is a second value.
Further, for each pixel position on the first image, in the case where it is the same as the corresponding pixel position on the second image and is a background portion, it is determined that the corresponding pixel position on the difference image is the third value.
In the image of the handwritten character (first image) and the image of the character (second image), usually, the text portion and the background portion are largely distinguished in color, and therefore, whether the pixel belongs to the text portion or the background portion can be distinguished by the value of the color of the pixel. For example, images of handwritten digital images and characters are typically black-on-white, color-on-white (e.g., blue) words.
As an example, an image of a handwritten character and an image of a character are converted into a black-and-white image, and in this case, a color value of a character portion is 1 and a color value of a background portion is 0 in the image of the handwritten character and the image of the character. Referring to fig. 4, for each pixel location of the difference image: if the color values on the image of the handwritten character and the image of the character are both 0, setting the color value of the pixel position of the difference image to be 0; if the color values on the image of the handwritten character and the image of the character are both 1, setting the pixel position color value of the difference image to be 0.5; if the color values on the image of the handwritten word and the image of the character are different, the pixel position of the difference image is set to 1.
And step S104, determining the detection result of the handwritten character according to the image matching result.
As a possible implementation, step S104 includes: determining characters matched with the handwritten characters in the first character set according to the image matching result; and determining the detection result of the handwritten character according to the characters matched with the handwritten character in the first character set.
As an example, determining characters in the first character set that match the handwritten word based on the image matching result includes: determining a first number of second images in the first character set that each character matches the first image; and determining a character matching result of each character and the handwritten character according to the first number corresponding to each character in the first character set.
As an example, determining a character matching result of each character with the handwritten word based on a first number corresponding to each character in the first character set includes: for each character in the first character set, determining that the character matches the handwritten word if the first number corresponding to the character is greater than a first preset number.
Alternatively, each character in the first character set is respectively preset with the first preset number in consideration of the difference of the complexity of the character (for example, the number of strokes, etc.).
As an example, determining a detection result of the handwritten word from characters matching the handwritten word in the first character set includes: and determining the detection result of the handwritten word according to the second number of the characters matched with the handwritten word in the first character set.
In some embodiments, the detection result of the handwritten word is determined according to the image matching result, so that the handwritten word which cannot be recognized by text recognition can be recognized.
In some embodiments, the detection result of the handwritten character is determined according to the image matching result, and the detection of the writing condition of the handwritten character can be realized.
Fig. 5 illustrates another flowchart of a handwritten word detection method according to an exemplary embodiment of the present disclosure, which includes steps S501 to S506, as illustrated in fig. 5.
In step S501, a first image including a single handwritten word is acquired.
Step S502, text recognition is carried out on the first image, and a first character set and the confidence coefficient of each character in the first character set are obtained.
In step S503, the relationship between the maximum confidence in the first character set and the false confidence threshold and the true confidence threshold is determined.
Wherein, if the maximum confidence in the first character set is less than or equal to the false value confidence threshold, a handwriting error on the first image is determined. If the maximum confidence coefficient in the first character set is greater than or equal to the true confidence coefficient threshold value, determining that the handwritten characters on the first image are written correctly, and outputting the characters obtained by recognition; if the maximum confidence in the first character set is greater than the false confidence threshold and less than the true confidence threshold, go to step S504.
Step S504, if the maximum confidence in the first character set is greater than the false confidence threshold and less than the true confidence threshold, the first image is matched with a second image associated with each character in the first character set to obtain an image matching result.
As a possible implementation, step S504 includes:
performing image difference processing between the first image and each second image associated with each character in the first character set to obtain a difference image between the first image and each second image associated with each character in the first character set;
and processing each difference image by using a pre-trained neural network model to obtain an image matching result of each second image associated with each character in the first character set and the first image.
The purpose of the map difference processing is to highlight the difference between the two images. For the images of the handwritten characters, if the handwriting is consistent, the same position on the two images is the same part, namely, the same image area is both the character part or both the background parts except the character part.
As an example, in order to make the neural network model focus on the writing difference, the graph difference processing is performed between the first image and each second image associated with each character in the first character set, and the graph difference processing includes:
for each pixel position on the first image, under the condition that the pixel position on the first image is different from the corresponding pixel position on each second image, determining that the corresponding pixel position on the difference image is a first value, wherein the first image and the second image are divided into a text part and a background part;
for each pixel position on the first image, under the condition that the pixel position is the same as the corresponding pixel position on the second image and is a character part, determining that the corresponding pixel position on the difference image is a second value;
for each pixel location on the first image, where it is the same as the corresponding pixel location on the second image and is part of the background, determining that the corresponding pixel location on the difference image is the third value.
And step S505, determining characters matched with the handwritten characters in the first character set according to the image matching result.
As an embodiment, step S505 includes:
determining a first number of second images in the first character set that each character matches the first image;
and determining a character matching result of each character and the handwritten character according to the first number corresponding to each character in the first character set.
As an example, determining a character matching result of each character with the handwritten word based on a first number corresponding to each character in the first character set includes: for each character in the first character set, determining that the character matches the handwritten word if the first number corresponding to the character is greater than a first preset number.
Alternatively, each character in the first character set is respectively preset with the first preset number in consideration of the difference of the complexity of the character (for example, the number of strokes, etc.).
Step S506, determining the detection result of the handwritten character according to the characters matched with the handwritten character in the first character set.
As an embodiment, step S506 includes: and determining the detection result of the handwritten word according to the second number of the characters matched with the handwritten word in the first character set.
Handwritten characters are very common in a job intelligent correction scene, and an example of the present disclosure is described below by taking the job correction scene as an example.
In this example, as shown in FIG. 6, a semantic segmentation module, an OCR module, and a misword detection module are included.
Semantic segmentation module
The semantic segmentation module performs image semantic segmentation on the work handwritten image, and segments the written content in the work handwritten image by taking characters as units to form a group of images which are represented as T.
OCR module
And the OCR module identifies each picture in the T and converts each picture into a character with the maximum confidence coefficient.
In this process, for each small picture in T, a confidence is generated for each character in the recognizable character set C supported by OCR (or some OCR schemes may select a character with a higher confidence for calculation, and the confidence of the other unselected characters is set to 0). The confidence set is represented by S, S ═ S 1 ,s 2 ,…,s n ]Wherein s is i Indicating character c i Confidence for a picture in T.
The confidence set S is obtained not limited to the OCR process, but may also be scored in combination with the high-dimensional text information before and after the OCR process. This example will not be described in detail.
The following operations are performed in units of small pictures in T, which are denoted by T.
Wrong word detection module
As shown in fig. 7, the wrong word detection module is further divided into 3 modules, namely a detection filtering module, an image comparison module and a comprehensive judgment module.
Detection filtering module
For t, in the above process, a set of confidence levels S for each element in the supported character set C is obtained, and the score S with the highest confidence level is selected max Determining the value through the formula (1):
f(s max ) The values are as follows:
1,s max is greater than or equal to th r,i ;
0,th f,i Is less than s max Is less than th r,i ;
-1,s max Is less than or equal to th f,i ;
Therein, th r,i Indicates the character C in C i True confidence threshold if a character c i Corresponding confidence s i Is the highest value of S, and S i Is greater than or equal to th r,i If the character in t is written correctly, the result in the formula (1) is 1; th (h) f,i Representing a false confidence threshold for each character in C, s being ci i Is the highest value of S, and S i Is less than or equal to th f,i If the character in the t is wrongly written, the result in the formula is-1; and the other cases are 0, and the image comparison module is entered.
th r,i And th f,i It can be statistically derived from the OCR test set in a specific task.
The true confidence threshold of each character in C may be the same, or may be set separately for each character. The false value confidence threshold of each character in C may be the same, or may be set separately for each character. Because each character is different, for example, a word with a complex stroke and a simple word, different characters can be processed differently when set separately.
When the formula output is 0, selecting k characters (k is a hyper-parameter and can be set to be 3-10 according to scene setting) corresponding to (topk) with the first k names with confidence degrees in S, adding characters corresponding to elements with S larger than a false confidence degree threshold value, setting a union character of the two parts as H, and setting the number of the characters as m, wherein H is [ H ═ H 1 ,h 2 ,…,h m ]。
Image comparison module
In the image comparison module, a set of handwritten images is collected for each character (recognizable character) in C, and this image library is collected manually. The collected standard is a writing method of multiple specifications in a use scene, but the specified standard is difficult to quantify and can be selected by voting of multiple persons. The number of pictures in the sub-picture set corresponding to each character is not required to be consistent. And (4) judging whether t is consistent with the handwritten image content corresponding to each character in the H or not by image comparison.
The pictures in the set of m sets of handwritten images corresponding to t and H are grouped into image pairs (original image t and comparison image d), and the following processing is performed in units of each pair. The small figures in this case are all black and white pictures of consistent specifications.
As shown in fig. 8, the image comparison module includes a map difference module, a feature extraction module, and a classifier module.
Graph difference module
The image difference module receives the original image t and a comparison image d (the image of the characters in the H), and calculates according to a formula (2) to obtain a difference image q:
q ij =0,t ij =d ij =0;
q ij =0.5,t ij =d ij =1;
q ij =1,t ij is not equal to d ij ;
Where i and j represent the row and column indices of the image pixels. Setting the unequal positions to 1 may make the model focus more on the different locations of the pixels. The difference image q then enters the feature extraction module.
Feature extraction module
The feature extraction module extracts high-dimensional features of the difference image q, and a Convolutional Neural Network (CNN) or some novel network structures can be used.
Classifier module
The classifier module uses a fully connected network layer.
Through the classifier module, each image of each character in H obtains an identification result, positive examples (the number of matched images) of each character in H are obtained through statistics, and positive example statistics is formed: z ═ Z 1 ,z 2 ,…,z m ]. E.g. h 1 If there are 3 images matching t, then z 1 The value is 3.
Comprehensive judgment module
Passing Z through equation (3) to obtain M:
m i =0,zi=0。
for t, O is obtained by equation (4):
O=sum(M)。
and giving evaluation to the situation of writing characters in t. A total of 5 levels, respectively level A, B, C, D, E, are included.
Wherein:
equation (1) (i.e., f(s) max ) ) the output result is 1, set as level a;
when the output result of formula (4) (i.e., O) is 1, it is set as level B;
if the output result of the formula (4) is greater than 1, setting the output result as a grade C;
if the output result of the formula (4) is equal to 0, the level is set as D;
if the output result of the formula (1) is-1, setting the output result as a grade E;
the level A, B is correct writing, the level C is irregular writing, and the level D, E is incorrect writing.
In this example, handwritten word recognition can be well addressed by combining the OCR process with image comparison for miswritten word detection, and by highlighting differences in image differences, weakening the same points for information fusion of the two images. And by combining the operation correction scene, a handwriting condition grading strategy is provided for increasing user experience, the condition of wrongly written characters is judged by comparing results of different character subgraphs, and different grades of feedback are given.
Fig. 9 shows a schematic diagram of a handwritten word detection apparatus according to an exemplary embodiment of the present disclosure, and as shown in fig. 9, the handwritten word detection apparatus includes:
an obtaining module 910 configured to obtain a first image including a single handwritten word;
a recognition module 920, configured to perform text recognition on the first image to obtain a first character set and a confidence level of each character in the first character set;
a matching module 930, configured to match the first image with a second image associated with each character in the first character set to obtain an image matching result when the maximum confidence in the first character set is greater than the false confidence threshold and less than the true confidence threshold, where each character in the first character set is associated with an image of at least one handwritten word thereof;
a determining module 940, configured to determine a detection result of the handwritten word according to the image matching result.
As an embodiment, the determining module 940, according to the image matching result, determines a detection result of the handwritten character, which specifically includes:
determining characters matched with the handwritten characters in the first character set according to the image matching result;
and determining the detection result of the handwritten character according to the characters matched with the handwritten character in the first character set.
As an embodiment, the determining module 940, according to the image matching result, determines the characters in the first character set that match the handwritten word, specifically including:
determining a first number of second images in the first character set that each character matches the first image;
and determining a character matching result of each character and the handwritten character according to the first number corresponding to each character in the first character set.
As an embodiment, the determining module 940, according to the first number corresponding to each character in the first character set, determines a character matching result between each character and the handwritten word, and specifically includes:
for each character in the first character set, determining that the character matches the handwritten word if the first number corresponding to the character is greater than a first preset number.
In one embodiment, each character in the first character set is respectively preset with a first preset number.
As an embodiment, the determining module 940, according to the characters matched with the handwritten character in the first character set, determines the detection result of the handwritten character, and specifically includes: and determining the detection result of the handwritten word according to the second number of the characters matched with the handwritten word in the first character set.
As an embodiment, the matching module 930, which matches the first image with the second image associated with each character in the first character set to obtain an image matching result, specifically includes:
performing image difference processing between the first image and each second image associated with each character in the first character set to obtain a difference image between the first image and each second image associated with each character in the first character set;
and processing each difference image by using a pre-trained neural network model to obtain an image matching result of each second image associated with each character in the first character set and the first image.
As an embodiment, the matching module 930 performs graph difference processing between the first image and each second image associated with each character in the first character set, specifically including:
and for each pixel position on the first image, determining the corresponding pixel position on the difference image as a first value under the condition that the corresponding pixel position on each second image is different from the corresponding pixel position on each first image, wherein the first image and the second image are divided into a text part and a background part.
As an embodiment, the matching module 930, performing graph difference processing between the first image and each second image associated with each character in the first character set, further includes:
for each pixel position on the first image, under the condition that the pixel position is the same as the corresponding pixel position on the second image and is a character part, determining that the corresponding pixel position on the difference image is a second value; and/or
For each pixel location on the first image, where it is the same as the corresponding pixel location on the second image and is part of the background, determining that the corresponding pixel location on the difference image is the third value.
As an embodiment, further comprising: selecting characters meeting preset conditions from the first character set, wherein the preset conditions comprise: the confidence coefficient is greater than a preset threshold and/or the confidence coefficient is ranked on the previous preset name, wherein the preset threshold is greater than a false confidence coefficient threshold and less than a true confidence coefficient threshold; the matching module 930 is configured to match the first image with the second image associated with each selected character.
An exemplary embodiment of the present disclosure also provides an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor. The memory stores a computer program executable by the at least one processor, the computer program, when executed by the at least one processor, is for causing the electronic device to perform a method according to an embodiment of the disclosure.
The disclosed exemplary embodiments also provide a non-transitory computer readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is adapted to cause the computer to perform a method according to an embodiment of the present disclosure.
The exemplary embodiments of the present disclosure also provide a computer program product comprising a computer program, wherein the computer program, when executed by a processor of a computer, is adapted to cause the computer to perform a method according to an embodiment of the present disclosure.
Referring to fig. 10, a block diagram of a structure of an electronic device 1000, which may be a server or a client of the present disclosure, which is an example of a hardware device that may be applied to aspects of the present disclosure, will now be described. Electronic device is intended to represent various forms of digital electronic computer devices, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 10, the electronic device 1000 includes a computing unit 1001 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM)1002 or a computer program loaded from a storage unit 1008 into a Random Access Memory (RAM) 1003. In the RAM 1003, various programs and data necessary for the operation of the device 1000 can also be stored. The calculation unit 1001, the ROM 1002, and the RAM 1003 are connected to each other by a bus 1004. An input/output (I/O) interface 1005 is also connected to bus 1004.
A number of components in the electronic device 1000 are connected to the I/O interface 1005, including: input section 1006, output section 1007, storage section 1008, and communication section 1009. The input unit 1006 may be any type of device capable of inputting information to the electronic device 1000, and the input unit 1006 may receive input numeric or character information and generate key signal inputs related to user settings and/or function controls of the electronic device. Output unit 1007 may be any type of device capable of presenting information and may include, but is not limited to, a display, speakers, a video/audio output terminal, a vibrator, and/or a printer. The storage unit 1008 may include, but is not limited to, a magnetic disk, an optical disk. The communication unit 1009 allows the electronic device 1000 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers, and/or chipsets, such as bluetooth devices, WiFi devices, WiMax devices, cellular communication devices, and/or the like.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
As used in this disclosure, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
Claims (13)
1. A method for detecting handwritten characters, comprising:
acquiring a first image comprising a single handwritten word;
performing text recognition on the first image to obtain a first character set and a confidence coefficient of each character in the first character set;
under the condition that the maximum confidence coefficient in the first character set is greater than a false confidence coefficient threshold and less than a true confidence coefficient threshold, matching the first image with a second image associated with each character in the first character set to obtain an image matching result, wherein each character in the first character set is associated with an image of at least one handwritten word;
and determining the detection result of the handwritten character according to the image matching result.
2. The handwritten word detection method according to claim 1, wherein determining a detection result of the handwritten word from the image matching result includes:
determining characters matched with the handwritten characters in the first character set according to the image matching result;
and determining the detection result of the handwritten character according to the characters matched with the handwritten character in the first character set.
3. The method of detecting handwritten words according to claim 2, wherein determining characters in the first character set that match the handwritten word based on the image matching result comprises:
determining a first number of second images in the first character set that each character matches the first image;
and determining a character matching result of each character and the handwritten character according to the first number corresponding to each character in the first character set.
4. The method of detecting handwritten words according to claim 2, wherein determining the detection result of the handwritten word from characters matching the handwritten word in the first character set comprises:
and determining the detection result of the handwritten character according to the second number of the characters matched with the handwritten character in the first character set.
5. The method of detecting handwritten words according to claim 1, wherein matching said first image with a second image associated with each character in said first character set to obtain an image matching result comprises:
performing image difference processing between the first image and each second image associated with each character in the first character set to obtain a difference image between the first image and each second image associated with each character in the first character set;
and processing each difference image by using a pre-trained neural network model to obtain an image matching result of each second image associated with each character in the first character set and the first image.
6. The method of handwriting detection according to claim 5, wherein said differencing each second image associated with each character in said first character set with said first image comprises:
and for each pixel position on the first image, determining the corresponding pixel position on the difference image as a first value under the condition that the corresponding pixel position on each second image is different from the corresponding pixel position on each first image, wherein the first image and the second image are divided into a text part and a background part.
7. The handwritten word detection method of claim 6, further comprising:
for each pixel position on the first image, under the condition that the pixel position is the same as the corresponding pixel position on the second image and is a character part, determining that the corresponding pixel position on the difference image is a second value; and/or
For each pixel location on the first image, where it is the same as the corresponding pixel location on the second image and is a background portion, determining that the corresponding pixel location on the difference image is a third value.
8. The handwritten word detection method according to any of claims 1 to 7, further comprising:
selecting characters meeting preset conditions from the first character set, wherein the preset conditions comprise: the confidence coefficient is greater than a preset threshold and/or the confidence coefficient is arranged in a previous preset name, wherein the preset threshold is greater than the false confidence coefficient threshold and less than the true confidence coefficient threshold;
wherein matching the first image with a second image associated with each character in the first set of characters comprises: and matching the first image with a second image associated with each selected character.
9. The method of detecting handwritten words according to claim 3, wherein determining a character matching result of each character with said handwritten word based on said first number corresponding to each character in said first character set comprises:
for each character in the first set of characters, determining that the character matches the handwritten word if the first number corresponding to the character is greater than a first preset number.
10. The method of detecting handwritten words according to claim 9, wherein each character in said first character set is preset with said first preset number.
11. A handwritten character detection device, comprising:
an acquisition module for acquiring a first image comprising a single handwritten word;
the recognition module is used for performing text recognition on the first image to obtain a first character set and a confidence coefficient of each character in the first character set;
a matching module, configured to match the first image with a second image associated with each character in the first character set to obtain an image matching result when a maximum confidence in the first character set is greater than a false confidence threshold and less than a true confidence threshold, where each character in the first character set is associated with an image of at least one handwritten word thereof;
and the determining module is used for determining the detection result of the handwritten character according to the image matching result.
12. An electronic device, comprising:
a processor; and
a memory for storing a program, wherein the program is stored in the memory,
wherein the program comprises instructions which, when executed by the processor, cause the processor to carry out the method according to any one of claims 1-10.
13. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210777009.8A CN114973276A (en) | 2022-07-04 | 2022-07-04 | Handwritten character detection method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210777009.8A CN114973276A (en) | 2022-07-04 | 2022-07-04 | Handwritten character detection method and device and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114973276A true CN114973276A (en) | 2022-08-30 |
Family
ID=82967848
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210777009.8A Pending CN114973276A (en) | 2022-07-04 | 2022-07-04 | Handwritten character detection method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114973276A (en) |
-
2022
- 2022-07-04 CN CN202210777009.8A patent/CN114973276A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106951832B (en) | Verification method and device based on handwritten character recognition | |
WO2020140698A1 (en) | Table data acquisition method and apparatus, and server | |
EP3989104A1 (en) | Facial feature extraction model training method and apparatus, facial feature extraction method and apparatus, device, and storage medium | |
CN110598686B (en) | Invoice identification method, system, electronic equipment and medium | |
CN110942004A (en) | Handwriting recognition method and device based on neural network model and electronic equipment | |
CN113850238B (en) | Document detection method and device, electronic equipment and storage medium | |
WO2021159843A1 (en) | Object recognition method and apparatus, and electronic device and storage medium | |
CN114549993A (en) | Method, system and device for scoring line segment image in experiment and readable storage medium | |
US20230096921A1 (en) | Image recognition method and apparatus, electronic device and readable storage medium | |
US11113519B2 (en) | Character recognition apparatus, character recognition program, and character recognition method | |
CN107992872B (en) | Method for carrying out text recognition on picture and mobile terminal | |
CN111414889A (en) | Financial statement identification method and device based on character identification | |
CN104850819B (en) | Information processing method and electronic equipment | |
CN108334602B (en) | Data annotation method and device, electronic equipment and computer storage medium | |
WO2020124442A1 (en) | Pushing method and related product | |
CN114973276A (en) | Handwritten character detection method and device and electronic equipment | |
CN113255629B (en) | Document processing method and device, electronic equipment and computer readable storage medium | |
CN112257768B (en) | Method and device for identifying illegal financial pictures and computer storage medium | |
CN115273057A (en) | Text recognition method and device, dictation correction method and device and electronic equipment | |
CN115273103A (en) | Text recognition method and device, electronic equipment and storage medium | |
CN111860526B (en) | Image-based question judging method and device, electronic equipment and computer storage medium | |
CN115311649A (en) | Card type identification method and device, electronic equipment and storage medium | |
US20240176951A1 (en) | Electronic document validation | |
CN115273090A (en) | Dictation detection method and device and electronic equipment | |
CN110008343B (en) | Text classification method, apparatus, device and computer readable 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 |