CN112488094A - Optical character recognition method and device and electronic equipment - Google Patents

Optical character recognition method and device and electronic equipment Download PDF

Info

Publication number
CN112488094A
CN112488094A CN202011513721.4A CN202011513721A CN112488094A CN 112488094 A CN112488094 A CN 112488094A CN 202011513721 A CN202011513721 A CN 202011513721A CN 112488094 A CN112488094 A CN 112488094A
Authority
CN
China
Prior art keywords
character image
character
recognition
classification
classification result
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
CN202011513721.4A
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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network 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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202011513721.4A priority Critical patent/CN112488094A/en
Publication of CN112488094A publication Critical patent/CN112488094A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • 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

Abstract

The embodiment of the disclosure discloses an optical character recognition method, an optical character recognition device and electronic equipment. One embodiment of the method comprises: acquiring a first character image, wherein the first character image comprises at least two character elements; classifying the first character image to generate a classification result, wherein the classification result comprises an arrangement direction of character elements in a character image direction, the character image direction is used for indicating a position relation between adjacent characters with semantic relation, and the arrangement direction is used for indicating the direction of the character elements according to the semantic relation; generating a second character image based on the classification result and the first character image; and carrying out optical character recognition on the second character image to obtain a recognition result. Thus, a new optical character recognition mode is provided.

Description

Optical character recognition method and device and electronic equipment
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to an optical character recognition method, an optical character recognition device, and an electronic device.
Background
With the development of the internet, users increasingly use terminal devices to realize various functions. For example, with the popularization of smart devices, people can easily acquire images. The text is used as high-level semantic information in the image, and can help people to better understand the image. The text information in the image is converted into the characters which can be read and edited by a computer, and the method has important significance for improving the multimedia retrieval capability, the industrial automation level, the scene understanding capability and the like.
Disclosure of Invention
This disclosure is provided to introduce concepts in a simplified form that are further described below in the detailed description. This disclosure is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, an embodiment of the present disclosure provides an optical character recognition method, where the method includes: acquiring a first character image, wherein the first character image comprises at least two character elements; classifying the first character image to generate a classification result, wherein the classification result comprises an arrangement direction of character elements in a character image direction, the character image direction is used for indicating a position relation between adjacent characters with semantic relation, and the arrangement direction is used for indicating the direction of the character elements according to the semantic relation; generating a second character image based on the classification result and the first character image; and carrying out optical character recognition on the second character image to obtain a recognition result.
In a second aspect, an embodiment of the present disclosure provides an optical character recognition apparatus, including: the character acquisition device comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring a first character image, and the first character image comprises at least two character elements; the classification unit is used for classifying the first character image to generate a classification result, wherein the classification result comprises an arrangement direction of character elements in a character image direction, the character image direction is used for indicating a position relation between adjacent characters with semantic relation, and the arrangement direction is used for indicating the direction of the character elements according to the semantic relation; a generation unit configured to generate a second character image based on the classification result and the first character image; and the recognition unit is used for carrying out optical character recognition on the second character image to obtain a recognition result.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the optical character recognition method according to the first aspect.
In a fourth aspect, the disclosed embodiments provide a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the steps of the optical character recognition method according to the first aspect.
According to the optical character recognition method, the optical character recognition device and the electronic equipment provided by the embodiment of the disclosure, before the optical character recognition is performed, the first character image is classified, a classification result is generated, and the classification result can include the arrangement direction of the character elements in the character image direction. Therefore, the correct trend of the character elements with semantic relation can be obtained, the situation that the recognition result does not accord with the semantic relation is avoided as much as possible, and the accuracy of the recognition result is improved.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
FIG. 1 is a flow diagram of one embodiment of an optical character recognition method according to the present disclosure;
FIGS. 2A and 2B are schematic diagrams of an application scenario of the optical character recognition method according to the present disclosure
FIGS. 3A and 3B are schematic diagrams of an application scenario of an optical character recognition method according to the present disclosure;
FIG. 4 is a schematic diagram of another embodiment of an optical character recognition method according to the present disclosure;
FIG. 5 is a schematic diagram of yet another embodiment of an optical character recognition method according to the present disclosure;
FIG. 6 is a schematic block diagram of one embodiment of an optical character recognition apparatus according to the present disclosure;
FIG. 7 is an exemplary system architecture to which the optical character recognition method of one embodiment of the present disclosure may be applied;
fig. 8 is a schematic diagram of a basic structure of an electronic device provided according to an embodiment 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 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.
Referring to FIG. 1, a flow diagram of one embodiment of an optical character recognition method according to the present disclosure is shown. The optical character recognition method as shown in fig. 1 includes the steps of:
step 101, a first character image is obtained.
In the present embodiment, an execution subject (e.g., a terminal device or a server) of the optical character recognition method may acquire the first character image.
In the present embodiment, the first character image may be an image including characters. The form and source of the first character image may be set according to an actual application scenario, and are not limited herein. The language to which the character belongs may be any one or more, and is not limited herein.
As an example, the first character image may include one or at least two character rows, and may also include one or at least two character columns.
As an example, the first character image may be cut from a video frame.
In this embodiment, the first character image may include at least two character elements.
Here, the above character element may indicate a character. Referring to fig. 3A, each word in "beauty all over the world" in fig. 3A can be understood as a character element. 6 character elements may be included in fig. 3A.
And 102, classifying the first character image to generate a classification result.
In this embodiment, the execution subject may classify the first character image, and generate a classification result.
Here, the classification result may include an arrangement direction of the character elements in the character image direction.
In this embodiment, the character image direction may indicate a positional relationship between adjacent characters having a semantic relation. The character image orientation may be a scalar quantity.
As an example, the character image direction of the character elements in the first character image may include a row direction or a column direction. The row direction may indicate that adjacent character elements having semantic relation are left-right adjacent, i.e. the left-right adjacent character elements form a semantic group. The column direction may indicate that adjacent character elements having semantic relation are adjacent up and down, i.e. the adjacent character elements form a semantic group.
Referring to fig. 3A, the characters in "beauty all over the world" in fig. 3A may be in a vertical position relationship, which may be understood as a row direction.
As an example, the character image direction of the character element in the first character image is diagonal. A slant may indicate that the center connecting lines between adjacent character elements having semantic relation are slanted.
Here, the arrangement direction may indicate a direction in which the character elements are arranged in a semantic meaning. The arrangement direction may be indicated by two vector directions parallel to the character image direction, which may be defined as a forward direction or a reverse direction along the distribution direction. In other words, the arrangement direction may be a forward direction or a reverse direction. For example, referring to fig. 3A, the arrangement direction in fig. 3A may be from top to bottom according to the trend of the semantic "beauty in nature". The arrangement direction of the character elements in the character image direction shown in fig. 3A is a positive direction if the arrangement direction is set in advance from top to bottom as a positive direction.
In some embodiments, the classification result may include an arrangement direction.
In some embodiments, the classification result may include a character image direction and an arrangement direction.
And 103, generating a second character image based on the classification result and the first character image.
In this embodiment, the executing body may generate a second character image based on the classification result and the first character image.
As an example, if the above classification result indicates that the arrangement direction of the character elements in the first character image is positive, the rotation processing may not be performed on the first character image.
As an example, if the classification result indicates that the arrangement direction of the character elements in the first character image is not positive, the first character image may be subjected to rotation processing to obtain a second character image.
And 104, performing optical character recognition on the second character image to obtain a recognition result.
In this embodiment, the execution main body may perform optical character recognition on the second character image to obtain a recognition result.
In this embodiment, the recognition process may adopt various methods, such as a euclidean space comparison method, a relaxed comparison method (relax), a Dynamic Programming (DP), a database establishment and comparison, a Hidden Markov model (Hidden Markov model hmm), and the like, which are not described herein again.
It should be noted that, in the optical character recognition method provided in this embodiment, before performing optical character recognition, the first character image is classified, and a classification result is generated, and the classification result may include an arrangement direction of the character elements in the character image direction. Therefore, the correct trend of the character elements with semantic relation can be obtained, the situation that the recognition result does not accord with the semantic relation is avoided as much as possible, and the accuracy of the recognition result is improved.
In some embodiments, the character image direction of the character elements in the first character image may include a row direction or a column direction.
Please refer to fig. 2A and fig. 2B. Fig. 2A shows a first character image in which the character image direction is the row direction, and the arrangement direction of the character elements in the row direction is the forward direction in the first character image. Fig. 2B shows a first character image in which the character image direction is the row direction, and the arrangement direction of the character elements in the first character image in the row direction is reverse. The reverse direction is 180 degrees from the forward direction.
Please refer to fig. 3A and fig. 3B. Fig. 3A shows a first character image in which the character image direction is the column direction, and the arrangement direction of the character elements in the column direction in the first character image is the forward direction. Fig. 3B shows a first character image in which the character image direction is the column direction, and the arrangement direction of the character elements in the first character image in the row direction is reverse. The reverse direction is 180 degrees from the forward direction.
It should be noted that the row direction and the column direction are the image directions of the characters that appear most frequently in the actual application scene. By setting the classification in the row direction and the column direction, the recognition speed and the recognition efficiency of the character image can be improved in an actual application scene.
Referring to FIG. 4, a flow diagram illustrating another embodiment of an optical character recognition method according to the present disclosure is shown.
Step 401, a first character image is obtained.
In this embodiment, the first character image includes at least two character elements.
For the related description of step 401, refer to step 101, and will not be described herein again.
Step 402, importing the first character image into a first classification model which is established in advance to obtain a first arrangement direction.
Here, the first arrangement direction may be understood as a classification result.
In this embodiment, the first classification model may be used to characterize a correspondence between the first character image and the first arrangement direction. In other words, the input of the first classification model may be the first character image, and the output may be the first arrangement direction. The output of the first classification model may not include the character image orientation.
Here, the first classification model may be trained on a first initial classification network. The training samples of the first initial classification network may be labeled with the arrangement direction in advance, and the labels of the arrangement direction may indicate the arrangement direction of the training samples. The specific structure of the first initial classification network may be set according to an actual application scenario, and is not limited herein.
As an example, the training process may include: acquiring a training sample from a training sample set comprising row direction samples and/or column direction samples; leading the obtained training sample into a first initial classification network which is not trained or is trained; the first initial classification network can output the classification result for the training sample (including the arrangement direction is forward or reverse); and performing loss calculation on the arrangement direction output by the first initial classification network and the arrangement direction in the label, and adjusting the weight in the first initial network based on the calculated loss value.
It can be understood that the stopping condition of the training can be set according to the actual application scenario, and is not limited herein; for example, the network update times are greater than a preset update times threshold, or the weight update amplitude is less than a preset amplitude threshold, and the like.
And 403, in response to the first arrangement direction indicating a preset reverse direction, rotating the first character image to the preset positive direction to obtain the second character image.
Here, reference may be made to fig. 2B, where fig. 2B shows a schematic diagram of a preset reverse direction in the case where the character image is in a row direction; in this case, the first character image may be rotated to the positive direction, please refer to the schematic diagram of the positive direction shown in fig. 2A.
Referring to fig. 3B, fig. 3B is a schematic diagram illustrating a preset reverse direction in the case that the character image is in the column direction; in this case, the first character image may be rotated to the positive direction, please refer to the schematic diagram of the positive direction shown in fig. 3A.
And 404, importing the second character image into a pre-established first character recognition model to obtain the recognition result.
Here, the training sample set of the first character recognition model includes row-direction samples and column-direction samples. The training samples may be pre-labeled with labels indicating the character recognition results.
Here, the line direction sample may be a character image in which the character image direction is the line direction. In other words, the character elements having semantic relation in the line direction sample have left-right positional relation.
Here, the column direction sample may be a character image in which the character image direction is the column direction. In other words, the character elements having semantic relation in the column direction sample are in the top-bottom position relationship.
Here, the first character recognition model may be trained on the first initial recognition network. The specific structure of the first initial identification network may be set according to an actual application scenario, and is not limited herein.
As an example, the training process for the first initial recognition network may include: acquiring a training sample from a training sample set comprising a row direction sample and a column direction sample; leading the obtained training sample into a first initial recognition network which is not trained or is trained; the first initial recognition network may output a character recognition result for the training sample; and performing loss calculation on the character recognition result output by the first initial recognition network and the character recognition result in the label, and adjusting the weight in the first initial recognition network based on the calculated loss value.
It should be noted that the first character recognition model is trained by using the row direction samples and the column direction samples, so that the first character recognition model has a better recognition capability for both the character images in the row direction and the character images in the column direction. In this case, the output of the first classification model includes the first arrangement direction, so that the output of the first classification model does not include the character image direction, thereby reducing the complexity of the first classification model and the links of selecting the character recognition model, and improving the classification speed and the recognition speed.
Referring to FIG. 5, a flow diagram of yet another embodiment of an optical character recognition method according to the present disclosure is shown.
Step 501, a first character image is obtained.
In this embodiment, the first character image includes at least two character elements.
For the related description of step 501, refer to step 101, and will not be described herein again.
Step 502, importing the first character image into a pre-established second classification model to obtain character image direction information and a second arrangement direction.
Here, the second arrangement direction and the character image direction information may be understood as a classification result.
In this embodiment, the second classification model may be used to characterize the correspondence between the first character image and both the character image direction information and the second arrangement direction. In other words, the input of the second classification model may be the first character image, and the output may be the character image direction information and the second arrangement direction.
Here, the second classification model may be trained on a second initial classification network. The training samples of the second initial classification network can be marked with character image direction information and arrangement direction labels in advance, and the arrangement direction labels can indicate the character image direction information and the arrangement direction of the training samples. The specific structure of the second initial classification network may be set according to an actual application scenario, which is not limited herein.
As an example, the training process may include: acquiring a training sample from a training sample set comprising a row direction sample and a column direction sample; leading the obtained training sample into a second initial classification network which is not trained or is trained; the second initial classification network can output the classification result of the training sample (including the arrangement direction is forward or reverse, and the character image direction information is row direction or column direction); performing loss calculation on the arrangement direction and the character image direction information output by the second initial classification network and the arrangement direction and the character image direction information in the label; the weights in the first initial network are adjusted based on the calculated loss values.
Step 503, in response to the second arrangement direction indicating a preset reverse direction, the first character image is rotated to the preset positive direction, and the second character image is obtained.
Here, reference may be made to fig. 2B, where fig. 2B shows a schematic diagram of a preset reverse direction in the case where the character image is in a row direction; in this case, the first character image may be rotated to the positive direction, please refer to the schematic diagram of the positive direction shown in fig. 2A.
Referring to fig. 3B, fig. 3B is a schematic diagram illustrating a preset reverse direction in the case that the character image is in the column direction; in this case, the first character image may be rotated to the positive direction, please refer to the schematic diagram of the positive direction shown in fig. 3A.
Step 504, in response to the direction information of the character image indicating the row direction, the second character image is imported into a second character recognition model which is established in advance, and the recognition result is obtained.
Here, the training sample set of the second character recognition model includes row direction samples. The training samples may be pre-labeled with labels indicating the character recognition results.
Here, the second character recognition model may be trained on a second initial recognition network. The specific structure of the second initial identification network may be set according to an actual application scenario, which is not limited herein.
As an example, the training process for the second initial recognition network may include: obtaining a training sample from a training sample set comprising row direction samples; leading the obtained training sample into a second initial recognition network which is not trained or is trained; the second initial recognition network may output a character recognition result for the training sample; and performing loss calculation on the character recognition result output by the second initial recognition network and the character recognition result in the label, and adjusting the weight in the second initial recognition network based on the calculated loss value.
Step 505, in response to the indication of the column direction by the character image direction information, importing the second character image into a pre-established third character recognition model to obtain the recognition result.
Here, the training sample set of the third character recognition model includes column direction samples. The training samples may be pre-labeled with labels indicating the character recognition results.
Here, the third character recognition model may be trained on a third initial recognition network. The specific structure of the third initial identification network may be set according to an actual application scenario, which is not limited herein.
As an example, the training process for the third initial recognition network may include: acquiring a training sample from a training sample set comprising column direction samples; leading the obtained training sample into a third initial recognition network which is not trained or is trained; the third initial recognition network may output a character recognition result for the training sample; and performing loss calculation on the character recognition result output by the third initial recognition network and the character recognition result in the label, and adjusting the weight in the third initial recognition network based on the calculated loss value.
It should be noted that the second classification model may determine the direction of the character image while determining the arrangement direction, and may introduce the second character image into the character recognition model corresponding to the direction of the character image after obtaining the second character image according to the arrangement direction; here, the character recognition models for recognizing the line-direction character images and the column-direction character images are set as two separate models, and the recognition capability of a single model for the character image corresponding to the model can be improved in a targeted manner, whereby the recognition accuracy for the line-direction character images can be improved, and the recognition accuracy for the column-direction character images can also be improved.
With further reference to fig. 6, as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an optical character recognition apparatus, which corresponds to the embodiment of the method shown in fig. 1, and which is particularly applicable in various electronic devices.
As shown in fig. 6, the optical character recognition apparatus of the present embodiment includes: an acquisition unit 601, a classification unit 602, a generation unit 603, and a recognition unit 604. The character acquisition unit is used for acquiring a first character image, wherein the first character image comprises at least two character elements; the classification unit is used for classifying the first character image to generate a classification result, wherein the classification result comprises an arrangement direction of character elements in a character image direction, the character image direction is used for indicating a position relation between adjacent characters with semantic relation, and the arrangement direction is used for indicating the direction of the character elements according to the semantic relation; a generation unit configured to generate a second character image based on the classification result and the first character image; and the recognition unit is used for carrying out optical character recognition on the second character image to obtain a recognition result.
In this embodiment, specific processes of the obtaining unit 601, the classifying unit 602, the generating unit 603, and the identifying unit 604 of the optical character recognition apparatus and technical effects thereof can refer to the related descriptions of step 101, step 102, step 103, and step 104 in the corresponding embodiment of fig. 1, and are not described herein again.
In some embodiments, the character image direction in the first character image comprises a row direction or a column direction.
In some embodiments, the classifying the first character image and generating a classification result includes: and importing the first character image into a pre-established first classification model to obtain a first arrangement direction.
In some embodiments, said generating a second character image based on said classification result and said first character image comprises: and responding to the first arrangement direction indication preset reverse direction, and rotating the first character image to the preset positive direction to obtain the second character image.
In some embodiments, the performing optical character recognition on the second character image to obtain a recognition result includes: and importing the second character image into a pre-established first character recognition model to obtain the recognition result, wherein the training sample set of the first character recognition model comprises row direction samples and column direction samples.
In some embodiments, the classifying the first character image and generating a classification result includes: and importing the first character image into a pre-established second classification model to obtain character image direction information and a second arrangement direction.
In some embodiments, said generating a second character image based on said classification result and said first character image comprises: and responding to the second arrangement direction to indicate a preset reverse direction, and rotating the first character image to the preset positive direction to obtain the second character image.
In some embodiments, the performing optical character recognition on the second character image to obtain a recognition result includes: in response to the fact that the character image direction information indicates the row direction, the second character image is led into a pre-established second character recognition model to obtain the recognition result, wherein a training sample set of the second character recognition model comprises row direction samples; and in response to the indication of the column direction by the character image direction information, importing the second character image into a pre-established third character recognition model to obtain the recognition result, wherein a training sample set of the third character recognition model comprises column direction samples.
Referring to fig. 7, fig. 7 illustrates an exemplary system architecture to which the optical character recognition method of one embodiment of the present disclosure may be applied.
As shown in fig. 7, the system architecture may include terminal devices 701, 702, 703, a network 704, and a server 705. The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The terminal devices 701, 702, 703 may interact with a server 705 over a network 704 to receive or send messages or the like. The terminal devices 701, 702, 703 may have various client applications installed thereon, such as a web browser application, a search-type application, and a news-information-type application. The client applications in the terminal devices 701, 702, and 703 may receive the instruction of the user, and complete corresponding functions according to the instruction of the user, for example, add corresponding information to the information according to the instruction of the user.
The terminal devices 701, 702, and 703 may be hardware or software. When the terminal devices 701, 702, and 703 are hardware, they may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, mpeg compression standard Audio Layer 3), MP4 players (Moving Picture Experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like. When the terminal devices 701, 702, and 703 are software, they can be installed in the electronic devices listed above. It may be implemented as multiple pieces of software or software modules (e.g., software or software modules used to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 705 may be a server providing various services, for example, receiving an information acquisition request sent by the terminal devices 701, 702, and 703, and acquiring display information corresponding to the information acquisition request in various ways according to the information acquisition request. And the relevant data of the presentation information is sent to the terminal devices 701, 702, 703.
It should be noted that the optical character recognition method provided by the embodiment of the present disclosure may be executed by a terminal device, and accordingly, the optical character recognition apparatus may be disposed in the terminal devices 701, 702, and 703. In addition, the optical character recognition method provided by the embodiment of the present disclosure may also be executed by the server 705, and accordingly, an optical character recognition apparatus may be disposed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to fig. 8, shown is a schematic diagram of an electronic device (e.g., a terminal device or a server of fig. 7) suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 8, an electronic device may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 801 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage means 808 into a Random Access Memory (RAM) 803. In the RAM803, various programs and data necessary for the operation of the electronic apparatus 800 are also stored. The processing apparatus 801, the ROM 802, and the RAM803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
Generally, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 807 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage 808 including, for example, magnetic tape, hard disk, etc.; and a communication device 809. The communication means 809 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. While fig. 8 illustrates an electronic device having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 809, or installed from the storage means 808, or installed from the ROM 802. The computer program, when executed by the processing apparatus 801, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having 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. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a first character image, wherein the first character image comprises at least two character elements; classifying the first character image to generate a classification result, wherein the classification result comprises an arrangement direction of character elements in a character image direction, the character image direction is used for indicating a position relation between adjacent characters with semantic relation, and the arrangement direction is used for indicating the direction of the character elements according to the semantic relation; generating a second character image based on the classification result and the first character image; performing optical character recognition on the second character image to obtain a recognition result
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Here, the name of the cell does not constitute a limitation of the cell itself in some cases, and for example, the acquiring unit may also be described as "a cell that acquires the first character image".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
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.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (11)

1. An optical character recognition method, comprising:
acquiring a first character image, wherein the first character image comprises at least two character elements;
classifying the first character image to generate a classification result, wherein the classification result comprises an arrangement direction of character elements in a character image direction, the character image direction is used for indicating a position relation between adjacent characters with semantic relation, and the arrangement direction is used for indicating the direction of the character elements according to the semantic relation;
generating a second character image based on the classification result and the first character image;
and carrying out optical character recognition on the second character image to obtain a recognition result.
2. The method of claim 1, wherein the character image direction in the first character image comprises a row direction or a column direction.
3. The method of claim 2, wherein the classifying the first character image to generate a classification result comprises:
and importing the first character image into a pre-established first classification model to obtain a first arrangement direction.
4. The method of claim 3, wherein generating a second character image based on the classification result and the first character image comprises:
and responding to the first arrangement direction indication preset reverse direction, and rotating the first character image to the preset positive direction to obtain the second character image.
5. The method of claim 4, wherein the performing optical character recognition on the second character image to obtain a recognition result comprises:
and importing the second character image into a pre-established first character recognition model to obtain the recognition result, wherein the training sample set of the first character recognition model comprises row direction samples and column direction samples.
6. The method of claim 2, wherein the classifying the first character image to generate a classification result comprises:
and importing the first character image into a pre-established second classification model to obtain character image direction information and a second arrangement direction.
7. The method of claim 6, wherein generating a second character image based on the classification result and the first character image comprises:
and responding to the second arrangement direction to indicate a preset reverse direction, and rotating the first character image to the preset positive direction to obtain the second character image.
8. The method of claim 7, wherein the performing optical character recognition on the second character image to obtain a recognition result comprises:
in response to the fact that the character image direction information indicates the row direction, the second character image is led into a pre-established second character recognition model to obtain the recognition result, wherein a training sample set of the second character recognition model comprises row direction samples;
and in response to the indication of the column direction by the character image direction information, importing the second character image into a pre-established third character recognition model to obtain the recognition result, wherein a training sample set of the third character recognition model comprises column direction samples.
9. An optical character recognition apparatus, comprising:
the character acquisition device comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring a first character image, and the first character image comprises at least two character elements;
the classification unit is used for classifying the first character image to generate a classification result, wherein the classification result comprises an arrangement direction of character elements in a character image direction, the character image direction is used for indicating a position relation between adjacent characters with semantic relation, and the arrangement direction is used for indicating the direction of the character elements according to the semantic relation;
a generation unit configured to generate a second character image based on the classification result and the first character image;
and the recognition unit is used for carrying out optical character recognition on the second character image to obtain a recognition result.
10. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-8.
11. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-8.
CN202011513721.4A 2020-12-18 2020-12-18 Optical character recognition method and device and electronic equipment Pending CN112488094A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011513721.4A CN112488094A (en) 2020-12-18 2020-12-18 Optical character recognition method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011513721.4A CN112488094A (en) 2020-12-18 2020-12-18 Optical character recognition method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN112488094A true CN112488094A (en) 2021-03-12

Family

ID=74915071

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011513721.4A Pending CN112488094A (en) 2020-12-18 2020-12-18 Optical character recognition method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112488094A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106897990A (en) * 2016-08-31 2017-06-27 广东工业大学 The character defect inspection method of tire-mold
CN107633219A (en) * 2017-09-11 2018-01-26 北京百度网讯科技有限公司 Integrated optical character identifying method and system
CN108288078A (en) * 2017-12-07 2018-07-17 腾讯科技(深圳)有限公司 Character identifying method, device and medium in a kind of image
CN110097019A (en) * 2019-05-10 2019-08-06 腾讯科技(深圳)有限公司 Character identifying method, device, computer equipment and storage medium
CN111832550A (en) * 2020-07-13 2020-10-27 北京易真学思教育科技有限公司 Data set manufacturing method and device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106897990A (en) * 2016-08-31 2017-06-27 广东工业大学 The character defect inspection method of tire-mold
CN107633219A (en) * 2017-09-11 2018-01-26 北京百度网讯科技有限公司 Integrated optical character identifying method and system
CN108288078A (en) * 2017-12-07 2018-07-17 腾讯科技(深圳)有限公司 Character identifying method, device and medium in a kind of image
CN110097019A (en) * 2019-05-10 2019-08-06 腾讯科技(深圳)有限公司 Character identifying method, device, computer equipment and storage medium
CN111832550A (en) * 2020-07-13 2020-10-27 北京易真学思教育科技有限公司 Data set manufacturing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US11023716B2 (en) Method and device for generating stickers
CN112364860A (en) Training method and device of character recognition model and electronic equipment
CN110619078B (en) Method and device for pushing information
CN112883968B (en) Image character recognition method, device, medium and electronic equipment
CN112650841A (en) Information processing method and device and electronic equipment
CN110826567A (en) Optical character recognition method, device, equipment and storage medium
CN111897950A (en) Method and apparatus for generating information
CN115908640A (en) Method and device for generating image, readable medium and electronic equipment
CN114494709A (en) Feature extraction model generation method, image feature extraction method and device
CN112883966A (en) Image character recognition method, device, medium and electronic equipment
CN111797822A (en) Character object evaluation method and device and electronic equipment
CN112307393A (en) Information issuing method and device and electronic equipment
CN113191257B (en) Order of strokes detection method and device and electronic equipment
CN113220922B (en) Image searching method and device and electronic equipment
CN111611420B (en) Method and device for generating image description information
CN114004229A (en) Text recognition method and device, readable medium and electronic equipment
CN113255812A (en) Video frame detection method and device and electronic equipment
CN112488094A (en) Optical character recognition method and device and electronic equipment
CN115209215A (en) Video processing method, device and equipment
CN113033682A (en) Video classification method and device, readable medium and electronic equipment
CN112214695A (en) Information processing method and device and electronic equipment
CN111382365A (en) Method and apparatus for outputting information
CN110598049A (en) Method, apparatus, electronic device and computer readable medium for retrieving video
CN111680754A (en) Image classification method and device, electronic equipment and computer-readable storage medium
CN113283115B (en) Image model generation method and device and electronic equipment

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