WO2022156066A1 - 文字识别方法、装置、电子设备及存储介质 - Google Patents

文字识别方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2022156066A1
WO2022156066A1 PCT/CN2021/083826 CN2021083826W WO2022156066A1 WO 2022156066 A1 WO2022156066 A1 WO 2022156066A1 CN 2021083826 W CN2021083826 W CN 2021083826W WO 2022156066 A1 WO2022156066 A1 WO 2022156066A1
Authority
WO
WIPO (PCT)
Prior art keywords
text
frame
feature
image
character
Prior art date
Application number
PCT/CN2021/083826
Other languages
English (en)
French (fr)
Inventor
刘翔
刘莹
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2022156066A1 publication Critical patent/WO2022156066A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/049Temporal neural networks, e.g. delay elements, oscillating neurons or pulsed inputs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • 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
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging

Definitions

  • the present application relates to the field of image detection, and in particular, to a character recognition method, device, electronic device, and computer-readable storage medium.
  • Text recognition refers to a process of extracting text from text images. For example, when a government department is reviewing official texts, in order to extract important information, it is often necessary to identify text in official text images.
  • OCR Optical Character Recognition
  • OCR refers to the process of analyzing and recognizing file images of text data to obtain text and layout information.
  • a text recognition method comprising:
  • the target text frame is clipped without text area to obtain a clipped text frame
  • a character recognition device comprising:
  • a detection module configured to acquire a text image, perform text detection on the text image, and obtain a text detection frame
  • a merging module for screening and merging the text detection frames to obtain a target text frame
  • a cropping module used for cropping the target text frame without text area to obtain a cropped text frame
  • an extraction module used for text extraction on the cropped text frame to obtain an initial text set
  • the recognition module is used for extracting the key words in the initial text set, and verifying the key words by using a regular verification technology, and using the key words that are successfully verified as the text recognition result of the text image.
  • An electronic device comprising:
  • the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to implement the following steps:
  • the target text frame is clipped without text area to obtain a clipped text frame
  • a computer-readable storage medium having at least one computer program stored in the computer-readable storage medium, the at least one computer program being executed by a processor in an electronic device to implement the following steps:
  • the target text frame is clipped without text area to obtain a clipped text frame
  • the present application can improve the accuracy of character recognition.
  • FIG. 1 is a schematic flowchart of a character recognition method provided by an embodiment of the present application.
  • FIG. 2 is a detailed schematic flowchart of one of the steps of the character recognition method provided in FIG. 1 in the first embodiment of the present application;
  • FIG. 3 is a schematic diagram of a module of a character recognition device provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of the internal structure of an electronic device implementing a character recognition method provided by an embodiment of the present application
  • the embodiment of the present application provides a method for character recognition.
  • the execution body of the character recognition method includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server and a terminal.
  • the character recognition method can be executed by software or hardware installed in a terminal device or a server device, and the software can be a blockchain platform.
  • the server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
  • the character recognition method includes:
  • the text image is obtained by image conversion of document text
  • the document text may be PDF text, such as government message text.
  • the embodiment of the present application uses the text target frame detection model that has been trained to perform text detection on the text image, wherein the text target frame detection model is constructed by a YOLO (You Only Look Once) neural network, which is used to detect The detection frame with the text position coordinates in the text image, including: convolution layer, batch normalization layer, fusion layer and activation function, etc.
  • the embodiment of the present application further includes: using a training text image set to train a pre-built text target frame detection model until the pre-built text target frame detection model is trained.
  • the training of the pre-built text target frame detection model is ended, and a trained text target frame detection model is obtained. It should be stated that the training process of the pre-built text target frame detection model belongs to a relatively mature technology at present, and will not be further described here.
  • performing text detection on the text image by using the trained text target frame detection model to obtain a text detection frame includes: using the convolution layer to perform image feature extraction on the text image to obtain a feature image; Use the batch normalization layer (Batch Normalization, BN) to standardize the feature image to obtain a standard feature image; use the fusion layer to fuse the underlying features of the text image with the standard feature image to obtain the target feature image; output the detection result of the target feature image by using the activation function, and generate a text detection frame according to the detection result.
  • Batch Normalization Batch Normalization
  • the image feature extraction may be realized by performing a convolution operation on the tensors of the input image; the batch normalization layer normalizes the extracted image features, which can accelerate the convergence of the model.
  • the normalization operation can be expressed as:
  • x′ i is the standard feature image set after batch normalization
  • xi is the feature image
  • is the mean value of the feature image
  • ⁇ 2 is the variance of the feature image set
  • is an infinitesimal random number.
  • the fusion layer fuses the underlying features of the image into the extracted image features, which can reduce the influence on the image grayscale changes caused by different gains.
  • the underlying feature refers to the basic features of the text image, such as color, length, width, etc.
  • the fusion described in the embodiment of the present application is through the cross-stage partial connection (Cross) in the fusion layer.
  • CSP Voltage-Partial-connections
  • the activation function includes:
  • s′ represents the activated target feature image
  • s represents the target feature image
  • the detection results include: x, y, height, width and category, etc., wherein x and y represent the center point of the target feature image, and the category indicates whether the target feature image is a text area, That is, category 0 indicates that it is not a text region, and category 1 indicates that the prediction region is a text region. Therefore, in this embodiment of the present application, a target feature image of category 1 is selected as a text region, thereby generating the text detection frame.
  • the text detection frames are screened and merged to obtain a target text frame, so as to screen out the text detection frames with confidence and repetition in the text detection frame, thereby improving the speed of subsequent text extraction.
  • the confidence level refers to the probability that the text falls within the detected text detection frame, that is, the higher the confidence level, the higher the probability that the detected text detection frame contains text.
  • the method further includes: using a non-maximum value algorithm (Non-Maximum Suppression, NMS) to perform non-maximum value processing on the text detection frame, In order to suppress the elements that are not the maximum value in the text detection frame, so as to improve the detection speed of the subsequent text detection frame.
  • NMS Non-Maximum Suppression
  • the text detection frame may be implemented by a currently known interval estimation method.
  • the screened text detection frames will include text detection frames with the same text, so the embodiment of the present application uses a preset merging rule to merge the screened text detection frames to Avoid identical text boxes.
  • the preset merging rule includes: merging text detection frames with the same adjacent text spacing, the same text height ratio, and the same text content in the screened text detection frames.
  • the target text frame is cropped in the textless area, so as to improve the text recognition performance of the subsequent model.
  • the cutting the target text frame without text area to obtain the cropped text frame includes: performing binarization processing on the target text frame to obtain a binarized text frame; querying the binarized text The text start position and text end position in the vertical axis direction of the frame and the vertical axis direction length of the binarized text box, according to the text start position, text end position and vertical axis direction length in the vertical axis direction, for
  • the binarized text frame is cut vertically to obtain a vertical cut text frame; the text start position and text end position in the horizontal axis direction of the vertical cut text frame and the horizontal axis length of the vertical cut text frame are inquired, According to the text start position and text end position in the horizontal axis direction and the length in the horizontal axis direction, horizontally crop the vertical cropped text frame to obtain the cropped text frame.
  • the binarization processing of the target text box includes: marking the text area in the target text box as 1, and marking the background area as 0.
  • the character start position, character end position, length along the vertical axis and length along the horizontal axis can be implemented by a precompiled query script, and the query script can be compiled by using a JavaScript script language.
  • the vertical cropping and horizontal cropping are implemented by currently known text cropping tools, such as Photoshop cropping tools.
  • text extraction is performed on the cropped text frame by using the trained text extraction model to obtain an initial text set.
  • the pre-trained text extraction model includes: Convolutional Neural Networks (CNN), Long Short-Term Memory (LSTM), and Connectionist temporal classification (CTC) construction , wherein the CNN is used to identify the characteristic text frame of the cropped text frame, the LSTM is used to extract the text sequence in the characteristic text frame, and the CTC is used to solve the problem that the characters in the text characteristic sequence cannot be aligned.
  • the CNN includes a convolution layer, a pooling layer and a fully connected layer, and the LSTM includes an input gate, a forget gate, and an output gate.
  • the method before using the trained text extraction model to perform text extraction on the cropped text frame, the method further includes: using the training cropped text frame set to train the pre-built text extraction model until the pre-built text extraction model is When the text extraction model tends to be stable, the training of the pre-built text extraction is ended, and the trained text extraction model is obtained.
  • the pre-built text extraction training process belongs to a relatively mature technology at present, and will not be described further here.
  • the text extraction is performed on the cropped text frame by using the pre-trained text extraction model to obtain an initial text set, including:
  • the S20 includes: using the convolution layer in the convolutional neural network to perform convolution feature extraction on the cropped text frame to obtain an initial feature text frame; using the pooling layer in the convolutional neural network Dimensionality reduction is performed on the initial feature clipping frame to obtain a dimensionality reduction feature text frame; the fully connected layer in the convolutional neural network is used to output the dimensionality reduction feature text frame to obtain a feature text frame;
  • the S21 includes: using the input gate of the long short-term memory network to calculate the state value of the characteristic text frame; using the forgetting gate of the long short-term memory network to calculate the activation value of the characteristic text frame; Calculate the state update value of the feature text box by using the state value and activation value; use the output gate of the long short-term memory network to calculate the text position sequence of the state update value to generate the original text set.
  • the training process of the convolutional neural network, long short-term memory network and time series classification network belongs to the current relatively mature technology, and will not be further elaborated here.
  • the key text in the initial text set is extracted to better help the user in information processing and improve the work efficiency.
  • the extracting the key words in the initial text set includes: deleting stop words in the initial text set, obtaining a standard text set, calculating the weight of each standard text in the standard text set, and obtaining a standard text from the standard text.
  • the standard text with the weight greater than the preset weight is centrally filtered out as the key text.
  • the deletion of the stop words may be filtered according to a stop word list, and if there is "de” in the stop word list, all "de”s in the initial text set are deleted.
  • the weight of the standard text can be obtained by calculating the proportion of each standard text in the standard text set, the preset weight can be 0.6, or can be set to other values, according to specific scenarios. set up.
  • the embodiment of the present application uses the regular verification technology to verify the key text, and the verification is successful.
  • the key text is used as the text recognition result of the text image.
  • the regular verification technology includes: a digital verification expression (such as ⁇ [0-9]*$), a Chinese character verification expression ( ⁇ [ ⁇ u4e00- ⁇ u9fa5] ⁇ 0, ⁇ $) and special requirements test expressions (such as date format: ⁇ d ⁇ 4 ⁇ - ⁇ d ⁇ 1, 2 ⁇ - ⁇ d ⁇ 1, 2 ⁇ ).
  • a digital verification expression such as ⁇ [0-9]*$
  • a Chinese character verification expression ⁇ [ ⁇ u4e00- ⁇ u9fa5] ⁇ 0, ⁇ $
  • special requirements test expressions such as date format: ⁇ d ⁇ 4 ⁇ - ⁇ d ⁇ 1, 2 ⁇ - ⁇ d ⁇ 1, 2 ⁇ .
  • the key words can also be stored in a blockchain node.
  • the embodiment of the present application first acquires a text image, performs text detection on the text image, and obtains a text detection frame, which can detect a detection frame with text position coordinates in the text image; secondly, the embodiment of the present application performs text detection on the text detection frame. Screening, merging, and cropping the textless area to obtain a cropped text frame, which can improve the character recognition performance, thereby greatly improving the accuracy of image text recognition;
  • the text set is extracted, and the key text in the initial text set is extracted, and the regular verification technology is used to verify the key text, and the key text that has been successfully verified is used as the text recognition result of the text image. Therefore, the present application can improve the accuracy of character recognition.
  • FIG. 3 it is a functional block diagram of the character recognition device of the present application.
  • the character recognition apparatus 100 described in this application can be installed in an electronic device.
  • the character recognition device may include a detection module 101 , a merge module 102 , a cropping module 103 , an extraction module 104 and a recognition module 105 .
  • the modules described in the present invention can also be called units, which refer to a series of computer program segments that can be executed by the electronic device processor and can perform fixed functions, and are stored in the memory of the electronic device.
  • each module/unit is as follows:
  • the detection module 101 is configured to acquire a text image, perform text detection on the text image, and obtain a text detection frame;
  • the merging module 102 is used for screening and merging the text detection frames to obtain a target text frame
  • the cropping module 103 is used for cropping the target text frame without text area to obtain a cropped text frame
  • the extraction module 104 is configured to perform text extraction on the cropped text frame to obtain an initial text set
  • the recognition module 105 is used to extract the key words in the initial text set, and use the regular verification technology to verify the key words, and use the key words that have been successfully verified as the text recognition results of the text image. .
  • the modules in the character recognition device 100 in the embodiments of the present application use the same technical means as the character recognition methods described in the above-mentioned FIG. 1 and FIG. 2 , and can generate the same technical means. The effect will not be repeated here.
  • FIG. 4 it is a schematic structural diagram of an electronic device implementing the character recognition method of the present application.
  • the electronic device 1 may include a processor 10, a memory 11 and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a character recognition program 12.
  • the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, magnetic disk, CD etc.
  • the memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as a mobile hard disk of the electronic device 1 .
  • the memory 11 may also be an external storage device of the electronic device 1, such as a pluggable mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital) equipped on the electronic device 1. , SD) card, flash memory card (Flash Card), etc.
  • the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device.
  • the memory 11 can not only be used to store application software installed in the electronic device 1 and various types of data, such as character recognition codes, etc., but also can be used to temporarily store data that has been output or will be output.
  • the processor 10 may be composed of integrated circuits, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits packaged with the same function or different functions, including one or more integrated circuits.
  • Central Processing Unit CPU
  • microprocessor digital processing chip
  • graphics processor and combination of various control chips, etc.
  • the processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect the various components of the entire electronic device, by running or executing the program or module (for example, executing the program) stored in the memory 11. character recognition, etc.), and call data stored in the memory 11 to perform various functions of the electronic device 1 and process data.
  • the bus may be a peripheral component interconnect (PCI for short) bus or an extended industry standard architecture (Extended industry standard architecture, EISA for short) bus or the like.
  • PCI peripheral component interconnect
  • EISA Extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus and so on.
  • the bus is configured to implement connection communication between the memory 11 and at least one processor 10 and the like.
  • FIG. 4 only shows an electronic device with components. Those skilled in the art can understand that the structure shown in FIG. 4 does not constitute a limitation on the electronic device 1, and may include fewer or more components than those shown in the drawings. components, or a combination of certain components, or a different arrangement of components.
  • the electronic device 1 may also include a power supply (such as a battery) for powering the various components, preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that the power management
  • the device implements functions such as charge management, discharge management, and power consumption management.
  • the power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and any other components.
  • the electronic device 1 may further include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
  • the electronic device 1 may also include a network interface, optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
  • a network interface optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
  • the electronic device 1 may further include a user interface, and the user interface may be a display (Display), an input unit (eg, a keyboard (Keyboard)), optionally, the user interface may also be a standard wired interface or a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, and the like.
  • the display may also be appropriately called a display screen or a display unit, which is used for displaying information processed in the electronic device 1 and for displaying a visualized user interface.
  • the character recognition 12 stored in the memory 11 in the electronic device 1 is a combination of a plurality of computer programs, and when running in the processor 10, can realize:
  • the target text frame is clipped without text area to obtain a clipped text frame
  • the modules/units integrated in the electronic device 1 may be stored in a non-volatile computer-readable storage medium.
  • the computer-readable storage medium may be volatile or non-volatile.
  • the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disc, a computer memory, a read-only memory (ROM, Read-Only). Memory).
  • the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium may be volatile or non-volatile.
  • the readable storage medium stores a computer program, and the computer program is stored in the When executed by the processor of the electronic device, it can achieve:
  • the target text frame is clipped without text area to obtain a clipped text frame
  • modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.
  • the blockchain referred to in this application is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Biomedical Technology (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Biophysics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Molecular Biology (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Character Discrimination (AREA)
  • Character Input (AREA)

Abstract

一种文字识别方法,包括:获取文本图像,对所述文本图像进行文字检测,得到文字检测框(S1);对所述文字检测框进行筛选及合并,得到目标文字框(S2);对所述目标文字框进行无文字区域裁剪,得到裁剪文字框(S3);对所述裁剪文字框进行文字提取,得到初始文字集(S4);提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果(S5)。此外,还涉及区块链技术,所述关键文字可存储于区块链中。上述方法可以提高文字识别的准确性。

Description

文字识别方法、装置、电子设备及存储介质
本申请要求于2021年1月19日提交中国专利局、申请号为CN202110068580.8,发明名称为“文字识别方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像检测领域,尤其涉及一种文字识别方法、装置、电子设备及计算机可读存储介质。
背景技术
文字识别是指提取文本图像中文字的一个过程,例如在政府部门在进行官文审查时,为了提取其中的重要信息,往往需要对官文图像中的文字进行识别。发明人意识到目前文字识别通常采用光学字符识别(Optical Character Recognition,OCR)实现,所述OCR是指对文本资料的文件图像进行分析识别处理,获取文字及版面信息的过程。
但是在利用OCR进行文本图像的文字识别时,无法准确定位到文本图像中文字位置和文字方向,这样容易导致识别出的文字准确率不高的现象。
发明内容
一种文字识别方法,包括:
获取文本图像,对所述文本图像进行文字检测,得到文字检测框;
对所述文字检测框进行筛选及合并,得到目标文字框;
对所述目标文字框进行无文字区域裁剪,得到裁剪文字框;
利用对所述裁剪文字框进行文字提取,得到初始文字集;
提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。
一种文字识别装置,所述装置包括:
检测模块,用于获取文本图像,对所述文本图像进行文字检测,得到文字检测框;
合并模块,用于对所述文字检测框进行筛选及合并,得到目标文字框;
裁剪模块,用于对所述目标文字框进行无文字区域裁剪,得到裁剪文字框;
提取模块,用于对所述裁剪文字框进行文字提取,得到初始文字集;
识别模块,用于提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。
一种电子设备,所述电子设备包括:
至少一个处理器;以及,
与所述至少一个处理器通信连接的存储器;其中,
所述存储器存储有可被所述至少一个处理器执行的计算机程序,所述计算机程序被所述至少一个处理器执行,以实现如下步骤:
获取文本图像,对所述文本图像进行文字检测,得到文字检测框;
对所述文字检测框进行筛选及合并,得到目标文字框;
对所述目标文字框进行无文字区域裁剪,得到裁剪文字框;
利用对所述裁剪文字框进行文字提取,得到初始文字集;
提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。
一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一个计算机程序,所述至少一个计算机程序被电子设备中的处理器执行以实现如下步骤:
获取文本图像,对所述文本图像进行文字检测,得到文字检测框;
对所述文字检测框进行筛选及合并,得到目标文字框;
对所述目标文字框进行无文字区域裁剪,得到裁剪文字框;
利用对所述裁剪文字框进行文字提取,得到初始文字集;
提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。
本申请可以提高文字识别的准确性。
附图说明
图1为本申请一实施例提供的文字识别方法的流程示意图;
图2为本申请第一实施例中图1提供的文字识别方法其中一个步骤的详细流程示意图;
图3为本申请一实施例提供的文字识别装置的模块示意图;
图4为本申请一实施例提供的实现文字识别方法的电子设备的内部结构示意图;
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请实施例提供一种文字识别方法。所述文字识别方法的执行主体包括但不限于服务端、终端等能够被配置为执行本申请实施例提供的该方法的电子设备中的至少一种。换言之,所述文字识别方法可以由安装在终端设备或服务端设备的软件或硬件来执行,所述软件可以是区块链平台。所述服务端包括但不限于:单台服务器、服务器集群、云端服务器或云端服务器集群等。
参照图1所示,为本申请一实施例提供的文字识别方法的流程示意图。在本申请实施例中,所述文字识别方法包括:
S1、获取文本图像,对所述文本图像进行文字检测,得到文字检测框。
本申请实施例中,所述文本图像通过文档文本进行图像转换得到,所述文档文本可以为PDF文本,如政府报文文本。进一步地,本申请实施例利用训练完成的文字目标框检测模型对所述文本图像进行文字检测,其中,所述文字目标框检测模型通过YOLO(You Only Look Once)神经网络构建,其用于检测文本图像中带有文字位置坐标的检测框,包括:卷积层、批标准化层、融合层及激活函数等。进一步地,本申请实施例在利用训练完成的文字目标框检测模型对所述文本图像进行文字检测之前还包括:利用训练文本图像集对预构建的文字目标框检测模型进行训练,直至所述预构建的文字目标框检测模型趋于稳定时,结束所述预构建的文字目标框检测模型的训练,得到训练完成的文字目标框检测模型。需要声明的是,所述预构建的文字目标框检测模型训练过程属于当前较为成熟的技术,在此不做进一步赘述。
详细地,所述利用训练完成的文字目标框检测模型对所述文本图像进行文字检测,得到文字检测框,包括:利用所述卷积层对所述文本图像进行图像特征提取,得到特征图像;利用所述批标准化层(Batch Normalization,BN)对所述特征图像进行标准化操作,得到标准特征图像;利用所述融合层将所述文本图像的底层特征与所述标准特征图像进行融合,得到目标特征图像;利用所述激活函数输出所述目标特征图像的检测结果,根据所述检测结果,生成文字检测框。
其中,所述图像特征提取可以是通过对输入图像的张量进行卷积操作实现;所述批标准化层对提取的图像特征进行标准化,可以加速模型的收敛。
一个优选实施例中,所述标准化操作可以表示为:
Figure PCTCN2021083826-appb-000001
其中,x′ i为批标准化后的标准特征图像集,x i为特征图像,μ为特征图像的均值,σ 2为特征图像集的方差,ε为无穷小的随机数。
所述融合层将图像的底层特征融合至提取的图像特征中,可以减小对不同增益引起的图像灰度变化影响。所述底层特征指的是所述文本图像的基本特征,例如,颜色、长度、宽度等等,较佳地,本申请实施例中所述融合通过所述融合层中的跨阶段部分连接(Cross-Stage-Partial-connections,CSP)模块实现。
一个优选实施例中,所述激活函数包括:
Figure PCTCN2021083826-appb-000002
其中,s′表示激活后的目标特征图像,s表示目标特征图像。
进一步地,本申请较佳实施中,所述检测结果包括:x、y、高、宽以及类别等,其中,x、y表示目标特征图像的中心点,类别表示目标特征图像是否为文字区域,即类别0表示不是文字区域,类别1表示预测区域是文字区域,于是,本申请实施例选取类别为1的目标特征图像作为文字区域,从而生成所述文字检测框。
S2、对所述文字检测框进行筛选及合并,得到目标文字框。
本申请实施例对所述文字检测框进行筛选及合并,得到目标文字框,以筛选出所述文字检测框中置信度及重复度的文字检测框,提高后续文字提取的速度。其中,所述置信度指的是文字落在检测出的文字检测框中的概率,即置信度越高,检测出的文字检测框包含文字的概率越大。
进一步地,本申请实施例在对所述文字检测框进行筛选及合并之前,还包括:利用非极大值算法(Non-Maximum Suppression,NMS)对所述文字检测框进行非极大值处理,以抑制所述文字检测框中不是极大值的元素,以提高后续文字检测框的检测速度。需要声明的是,所述非极大值算法属于当前较为成熟的技术,在此不做赘述。
进一步地,本申请的其中一个可选实施例中,所述文字检测框可以通过当前已知的区间估计法实现。
进一步地,应该了解,在筛选后的所述文字检测框中会包含具有相同文字的文字检测框,于是本申请实施例利用预设的合并规则对筛选后的所述文字检测框进行合并,以避免出现相同的文字检测框。其中,所述预设的合并规则包括:将筛选后的所述文字检测框中文字相邻间距相同、文字高度比值相同以及文字内容相同的文字检测框进行合并。
S3、对所述目标文字框进行无文字区域裁剪,得到裁剪文字框。
本申请实施例中,对所述目标文字框进行无文字区域裁剪,以提高后续模型文字识别性能。
详细地,所述对所述目标文字框进行无文字区域裁剪,得到裁剪文字框,包括:对所述目标文字框进行二值化处理,得到二值化文字框;查询所述二值化文字框中纵轴方向的文字起始位置和文字终止位置以及所述二值化文字框的纵轴方向长度,根据所述纵轴方向的文字起始位置、文字终止位置以及纵轴方向长度,对所述二值化文字框进行纵向裁剪,得到纵向裁剪文字框;查询所述纵向裁剪文字框中横轴方向的文字起始位置和文字终止位置以及所述纵向裁剪文字框的横轴方向长度,根据所述横轴方向的文字起始位置和文字终止位置以及横轴方向长度,对所述纵向裁剪文字框进行横向裁剪,得到所述裁剪文字框。
其中,所述目标文字框的二值化处理包括:将所述目标文字框中的文字区域标记为1,背景区域标记为0。
一个可选实施例中,所述文字起始位置、文字终止位置、纵轴方向长度以及横轴方向长度可以通过预编译的查询脚本实现,所述查询脚本可以通过JavaScript脚本语言编译。
一个可选实施例中,所述纵向裁剪和横向裁剪通过当前已知的文字裁剪工具实现,如Photoshop裁剪工具。
S4、对所述裁剪文字框进行文字提取,得到初始文字集。
本申请实施例中,利用训练完成的文字提取模型对所述裁剪文字框进行文字提取,得到初始文字集。其中,所述预先训练完成的文字提取模型包括:卷积神经网络(Convolutional Neural Networks,CNN)、长短期记忆网络(Long Short-Term Memory,LSTM)、时序分类网络(Connectionist temporal classification,CTC)构建,其中,所述CNN用于识别所述裁剪文字框的特征文字框,所述LSTM用于提取特征文字框中文字序列,所述CTC用于解决文字特征序列中字符无法对齐的问题。进一步地,所述CNN包括卷积层、池化层以及全连接层,所述LSTM包括:输入门、遗忘门以及输出门。
进一步地,本申请实施例在利用训练完成的文字提取模型对所述裁剪文字框进行文字提取之前还包括:利用训练裁剪文字框集对预构建的文字提取模型进行训练,直至所述预构建的文字提取模型趋于稳定时,结束所述预构建的文字提取的训练,得到训练完成的文字提取模型。需要声明的是,所述预构建的文字提取训练过程属于当前较为成熟的技术,在此不做进一步赘述。
详细地,参阅图2所示,所述利用预先训练完成的文字提取模型对所述裁剪文字框进行文字提取,得到初始文字集,包括:
S20、利用所述文字提取模型中的卷积神经网络对所述裁剪文字框进行特征提取,得到特征文字框;
S21、利用所述文字提取模型中的长短期记忆网络对所述特征文字框进行文字位置序列识别,生成原始文字集;
S22、利用所述文字提取模型中的时序分类网络对所述原始文字集进行字符对齐,生成初始文字集。
进一步地,所述S20包括:利用所述卷积神经网络中的卷积层对所述裁剪文字框进行卷积特征提取,得到初始特征文字框;利用所述卷积神经网络中的池化层对所述初始特征裁剪框进行降维,得到降维特征文字框;利用所述卷积神经网络中的全连接层输出所述降维特征文字框,得到特征文字框;
进一步地,所述S21包括:利用所述长短期记忆网络的输入门计算所述特征文字框的状态值;利用所述长短期记忆网络的遗忘门计算所述特征文字框的激活值;根据所述状态值和激活值计算所述特征文字框的状态更新值;利用所述长短期记忆网络的输出门计算所述状态更新值的文字位置序列,生成原始文字集。
进一步地,需要声明的是,所述卷积神经网络、长短期记忆网络以及时序分类网络的训练过程属于当前较为成熟的技术,在此不做进一步的阐述
S5、提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。
应该了解,在上述步骤S4获取的初始文字集中,会存在许多用户无法用到的文字,因此本申请实施例通过提取所述初始文字集中的关键文字,以更好地帮助用户进行信息处理,提高工作效率。
详细地,所述提取所述初始文字集中的关键文字包括:删除所述初始文字集中的停用词,得到标准文字集,计算所述标准文字集中每个标准文字的权重,从所述标准文字集中筛选出所述权重大于预设权重的标准文字作为所述关键文字。
一个可选实施例中,所述停用词的删除可以根据停用词表进行筛选,如停用词表中有“的”,则删除所述初始文字集中所有“的”。
一个可选实施例中,所述标准文字的权重可以通过计算每个标准文字在所述标准文字集中的占比得到,所述预设权重可以为0.6,也可以设置为其他数值,根据具体场景设置。
进一步地,应该了解,在提取的标准文字中可能会存在一些文字格式不正确的现象,比如汉字有误,因此本申请实施例利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。
一个可选实施例中,所述正则校验技术包括:数字校验表达式(如^[0-9]*$)、汉字校验表达式(^[\u4e00-\u9fa5]{0,}$)以及特殊需求检验表达式(如日期格式:^\d{4}-\d{1,2}-\d{1,2})。
进一步地,为保障所述关键文字的隐私性和复用性,所述关键文字还可存储于一区块链节点中。
本申请实施例首先获取文本图像,对所述文本图像进行文字检测,得到文字检测框,可以检测文本图像中带有文字位置坐标的检测框;其次,本申请实施例对所述文字检测框进行筛选、合并及无文字区域裁剪,得到裁剪文字框,可以提升文字识别性能,从而使得图片文字识别的准确率大大提高;进一步地,本申请实施例对所述裁剪文字框进行文字提取,得到初始文字集,并提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。因此,本申请可以提高文字识别的准确性。
如图3所示,是本申请文字识别装置的功能模块图。
本申请所述文字识别装置100可以安装于电子设备中。根据实现的功能,所述文字识别装置可以包括检测模块101、合并模块102、裁剪模块103、提取模块104以及识别模块105。本发所述模块也可以称之为单元,是指一种能够被电子设备处理器所执行,并且能够完成固定功能的一系列计算机程序段,其存储在电子设备的存储器中。
在本实施例中,关于各模块/单元的功能如下:
所述检测模块101,用于获取文本图像,对所述文本图像进行文字检测,得到文字检测框;
所述合并模块102,用于对所述文字检测框进行筛选及合并,得到目标文字框;
所述裁剪模块103,用于对所述目标文字框进行无文字区域裁剪,得到裁剪文字框;
所述提取模块104,用于对所述裁剪文字框进行文字提取,得到初始文字集;
所述识别模块105,用于提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。
详细地,本申请实施例中所述文字识别装置100中的所述各模块在使用时采用与上述的图1和图2中所述的文字识别方法一样的技术手段,并能够产生相同的技术效果,这里不再赘述。
如图4所示,是本申请实现文字识别方法的电子设备的结构示意图。
所述电子设备1可以包括处理器10、存储器11和总线,还可以包括存储在所述存储器11中并可在所述处理器10上运行的计算机程序,如文字识别程序12。
其中,所述存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、移动硬盘、多媒体卡、卡型存储器(例如:SD或DX存储器等)、磁性存储器、磁盘、光盘等。所述存储器11在一些实施例中可以是电子设备1的内部存储单元,例如该电子设备1的移动硬盘。所述存储器11在另一些实施例中也可以是电子设备1的外部存储设备,例如电子设备1上配备的插接式移动硬盘、智能存储卡(Smart Media Card,SMC)、安全数字(Secure Digital,SD)卡、闪存卡(Flash Card)等。进一步地,所述存储器11还可以既包括电子设备1的内部存储单元也包括外部存储设备。所述存储器11不仅可以用于存储安装于电子设备1的应用软件及各类数据,例如文字识别的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
所述处理器10在一些实施例中可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多 个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。所述处理器10是所述电子设备的控制核心(Control Unit),利用各种接口和线路连接整个电子设备的各个部件,通过运行或执行存储在所述存储器11内的程序或者模块(例如执行文字识别等),以及调用存储在所述存储器11内的数据,以执行电子设备1的各种功能和处理数据。
所述总线可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。所述总线被设置为实现所述存储器11以及至少一个处理器10等之间的连接通信。
图4仅示出了具有部件的电子设备,本领域技术人员可以理解的是,图4示出的结构并不构成对所述电子设备1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
例如,尽管未示出,所述电子设备1还可以包括给各个部件供电的电源(比如电池),优选地,电源可以通过电源管理装置与所述至少一个处理器10逻辑相连,从而通过电源管理装置实现充电管理、放电管理、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述电子设备1还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。
进一步地,所述电子设备1还可以包括网络接口,可选地,所述网络接口可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该电子设备1与其他电子设备之间建立通信连接。
可选地,该电子设备1还可以包括用户接口,用户接口可以是显示器(Display)、输入单元(比如键盘(Keyboard)),可选地,用户接口还可以是标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在电子设备1中处理的信息以及用于显示可视化的用户界面。
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。
所述电子设备1中的所述存储器11存储的文字识别12是多个计算机程序的组合,在所述处理器10中运行时,可以实现:
获取文本图像,对所述文本图像进行文字检测,得到文字检测框;
对所述文字检测框进行筛选及合并,得到目标文字框;
对所述目标文字框进行无文字区域裁剪,得到裁剪文字框;
对所述裁剪文字框进行文字提取,得到初始文字集;
提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。
具体地,所述处理器10对上述计算机程序的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。
进一步地,所述电子设备1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个非易失性计算机可读取存储介质中。所述计算机可读存储介质可以是易失性的,也可以是非易失性的。例如,所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质可以是易失性的,也可以是非易失性的,所述可读存储介质存储有计算机程序,所述计算机程序在被电子设 备的处理器所执行时,可以实现:
获取文本图像,对所述文本图像进行文字检测,得到文字检测框;
对所述文字检测框进行筛选及合并,得到目标文字框;
对所述目标文字框进行无文字区域裁剪,得到裁剪文字框;
对所述裁剪文字框进行文字提取,得到初始文字集;
提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。
因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。
此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。***权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第二等词语用来表示名称,而并不表示任何特定的顺序。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。

Claims (20)

  1. 一种文字识别方法,其中,所述方法包括:
    获取文本图像,对所述文本图像进行文字检测,得到文字检测框;
    对所述文字检测框进行筛选及合并,得到目标文字框;
    对所述目标文字框进行无文字区域裁剪,得到裁剪文字框;
    对所述裁剪文字框进行文字提取,得到初始文字集;
    提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。
  2. 如权利要求1所述的文字识别方法,其中,所述对所述文本图像进行文字检测,得到文字检测框,包括:
    利用文字目标框检测模型中的卷积层对所述文本图像进行图像特征提取,得到特征图像,所述文字目标框检测模型是预先训练完成的;
    利用所述文字目标框检测模型中批标准化层对所述特征图像进行标准化操作,得到标准特征图像;
    利用所述文字目标框检测模型中融合层将所述文本图像的底层特征与所述标准特征图像进行融合,得到目标特征图像;
    利用所述文字目标框检测模型中激活函数输出所述目标特征图像的检测结果,根据所述检测结果,生成文字检测框。
  3. 如权利要求1所述的文字识别方法,其中,所述对所述目标文字框进行无文字区域裁剪,得到裁剪文字框,包括:
    对所述目标文字框进行二值化处理,得到二值化文字框;
    查询所述二值化文字框中纵轴方向的文字起始位置和文字终止位置以及所述二值化文字框的纵轴方向长度,根据所述纵轴方向的文字起始位置、文字终止位置以及纵轴方向长度,对所述二值化文字框进行纵向裁剪,得到纵向裁剪文字框;
    查询所述纵向裁剪文字框中横轴方向的文字起始位置和文字终止位置以及所述纵向裁剪文字框的横轴方向长度,根据所述横轴方向的文字起始位置和文字终止位置以及横轴方向长度,对所述纵向裁剪文字框进行横向裁剪,得到裁剪文字框。
  4. 如权利要求1所述的文字识别方法,其中,所述对所述裁剪文字框进行文字提取,得到初始文字集,包括:
    利用文字提取模型中的卷积神经网络对所述裁剪文字框进行特征提取,得到特征文字框,所述文字提取模型是预先训练完成的;
    利用所述文字提取模型中的长短期记忆网络对所述特征文字框进行文字位置序列识别,生成原始文字集;
    利用所述文字提取模型中的时序分类网络对所述原始文字集进行字符对齐,生成初始文字集。
  5. 如权利要求4中所述的文字识别方法,其中,所述利用文字提取模型中的卷积神经网络对所述裁剪文字框进行特征提取,得到特征文字框,包括:
    利用所述卷积神经网络中的卷积层对所述裁剪文字框进行卷积特征提取,得到初始特征文字框;
    利用所述卷积神经网络中的池化层对所述初始特征裁剪框进行降维,得到降维特征文字框;
    利用所述卷积神经网络中的全连接层输出所述降维特征文字框,得到特征文字框。
  6. 如权利要求4中所述的文字识别方法,其中,所述利用所述文字提取模型中的长短期记忆网络对所述特征文字框进行文字位置序列识别,生成原始文字集,包括:
    利用所述长短期记忆网络的输入门计算所述特征文字框的状态值;
    利用所述长短期记忆网络的遗忘门计算所述特征文字框的激活值;
    根据所述状态值和激活值计算所述特征文字框的状态更新值;
    利用所述长短期记忆网络的输出门计算所述状态更新值的文字位置序列,生成原始文字集。
  7. 如权利要求1至6中任意一项所述的文字识别方法,其中,所述提取所述初始文字集中的关键文字,包括:
    删除所述初始文字集中的停用词,得到标准文字集;
    计算所述标准文字集中每个标准文字的权重,从所述标准文字集中筛选出所述权重大于预设权重的标准文字作为所述关键文字。
  8. 一种文字识别装置,其中,所述装置包括:
    检测模块,用于获取文本图像,对所述文本图像进行文字检测,得到文字检测框;
    合并模块,用于对所述文字检测框进行筛选及合并,得到目标文字框;
    裁剪模块,用于对所述目标文字框进行无文字区域裁剪,得到裁剪文字框;
    提取模块,用于对所述裁剪文字框进行文字提取,得到初始文字集;
    识别模块,用于提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。
  9. 一种电子设备,其中,所述电子设备包括:
    至少一个处理器;以及,
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的计算机程序,所述计算机程序被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下步骤:
    获取文本图像,对所述文本图像进行文字检测,得到文字检测框;
    对所述文字检测框进行筛选及合并,得到目标文字框;
    对所述目标文字框进行无文字区域裁剪,得到裁剪文字框;
    利用对所述裁剪文字框进行文字提取,得到初始文字集;
    提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。
  10. 如权利要求9所述的电子设备,其中,所述对所述文本图像进行文字检测,得到文字检测框,包括:
    利用文字目标框检测模型中的卷积层对所述文本图像进行图像特征提取,得到特征图像,所述文字目标框检测模型是预先训练完成的;
    利用所述文字目标框检测模型中批标准化层对所述特征图像进行标准化操作,得到标准特征图像;
    利用所述文字目标框检测模型中融合层将所述文本图像的底层特征与所述标准特征图像进行融合,得到目标特征图像;
    利用所述文字目标框检测模型中激活函数输出所述目标特征图像的检测结果,根据所述检测结果,生成文字检测框。
  11. 如权利要求9所述的电子设备,其中,所述对所述目标文字框进行无文字区域裁剪,得到裁剪文字框,包括:
    对所述目标文字框进行二值化处理,得到二值化文字框;
    查询所述二值化文字框中纵轴方向的文字起始位置和文字终止位置以及所述二值化文字框的纵轴方向长度,根据所述纵轴方向的文字起始位置、文字终止位置以及纵轴方向长度,对所述二值化文字框进行纵向裁剪,得到纵向裁剪文字框;
    查询所述纵向裁剪文字框中横轴方向的文字起始位置和文字终止位置以及所述纵向 裁剪文字框的横轴方向长度,根据所述横轴方向的文字起始位置和文字终止位置以及横轴方向长度,对所述纵向裁剪文字框进行横向裁剪,得到裁剪文字框。
  12. 如权利要求9所述的电子设备,其中,所述对所述裁剪文字框进行文字提取,得到初始文字集,包括:
    利用文字提取模型中的卷积神经网络对所述裁剪文字框进行特征提取,得到特征文字框,所述文字提取模型是预先训练完成的;
    利用所述文字提取模型中的长短期记忆网络对所述特征文字框进行文字位置序列识别,生成原始文字集;
    利用所述文字提取模型中的时序分类网络对所述原始文字集进行字符对齐,生成初始文字集。
  13. 如权利要求12中所述的电子设备,其中,所述利用文字提取模型中的卷积神经网络对所述裁剪文字框进行特征提取,得到特征文字框,包括:
    利用所述卷积神经网络中的卷积层对所述裁剪文字框进行卷积特征提取,得到初始特征文字框;
    利用所述卷积神经网络中的池化层对所述初始特征裁剪框进行降维,得到降维特征文字框;
    利用所述卷积神经网络中的全连接层输出所述降维特征文字框,得到特征文字框。
  14. 如权利要求12中所述的电子设备,其中,所述利用所述文字提取模型中的长短期记忆网络对所述特征文字框进行文字位置序列识别,生成原始文字集,包括:
    利用所述长短期记忆网络的输入门计算所述特征文字框的状态值;
    利用所述长短期记忆网络的遗忘门计算所述特征文字框的激活值;
    根据所述状态值和激活值计算所述特征文字框的状态更新值;
    利用所述长短期记忆网络的输出门计算所述状态更新值的文字位置序列,生成原始文字集。
  15. 如权利要求9至14中任意一项所述的电子设备,其中,所述提取所述初始文字集中的关键文字,包括:
    删除所述初始文字集中的停用词,得到标准文字集;
    计算所述标准文字集中每个标准文字的权重,从所述标准文字集中筛选出所述权重大于预设权重的标准文字作为所述关键文字。
  16. 一种计算机可读存储介质,存储有计算机程序,其中,所述计算机程序被处理器执行时实现如下步骤:
    获取文本图像,对所述文本图像进行文字检测,得到文字检测框;
    对所述文字检测框进行筛选及合并,得到目标文字框;
    对所述目标文字框进行无文字区域裁剪,得到裁剪文字框;
    对所述裁剪文字框进行文字提取,得到初始文字集;
    提取所述初始文字集中的关键文字,并利用正则校验技术对所述关键文字进行校验,将检验成功的所述关键文字作为所述文本图像的文字识别结果。
  17. 如权利要求16所述的计算机可读存储介质,其中,所述对所述文本图像进行文字检测,得到文字检测框,包括:
    利用文字目标框检测模型中的卷积层对所述文本图像进行图像特征提取,得到特征图像,所述文字目标框检测模型是预先训练完成的;
    利用所述文字目标框检测模型中批标准化层对所述特征图像进行标准化操作,得到标准特征图像;
    利用所述文字目标框检测模型中融合层将所述文本图像的底层特征与所述标准特征图像进行融合,得到目标特征图像;
    利用所述文字目标框检测模型中激活函数输出所述目标特征图像的检测结果,根据所述检测结果,生成文字检测框。
  18. 如权利要求16所述的计算机可读存储介质,其中,所述对所述目标文字框进行无文字区域裁剪,得到裁剪文字框,包括:
    对所述目标文字框进行二值化处理,得到二值化文字框;
    查询所述二值化文字框中纵轴方向的文字起始位置和文字终止位置以及所述二值化文字框的纵轴方向长度,根据所述纵轴方向的文字起始位置、文字终止位置以及纵轴方向长度,对所述二值化文字框进行纵向裁剪,得到纵向裁剪文字框;
    查询所述纵向裁剪文字框中横轴方向的文字起始位置和文字终止位置以及所述纵向裁剪文字框的横轴方向长度,根据所述横轴方向的文字起始位置和文字终止位置以及横轴方向长度,对所述纵向裁剪文字框进行横向裁剪,得到裁剪文字框。
  19. 如权利要求16所述的计算机可读存储介质,其中,所述对所述裁剪文字框进行文字提取,得到初始文字集,包括:
    利用文字提取模型中的卷积神经网络对所述裁剪文字框进行特征提取,得到特征文字框,所述文字提取模型是预先训练完成的;
    利用所述文字提取模型中的长短期记忆网络对所述特征文字框进行文字位置序列识别,生成原始文字集;
    利用所述文字提取模型中的时序分类网络对所述原始文字集进行字符对齐,生成初始文字集。
  20. 如权利要求19中所述的计算机可读存储介质,其中,所述利用文字提取模型中的卷积神经网络对所述裁剪文字框进行特征提取,得到特征文字框,包括:
    利用所述卷积神经网络中的卷积层对所述裁剪文字框进行卷积特征提取,得到初始特征文字框;
    利用所述卷积神经网络中的池化层对所述初始特征裁剪框进行降维,得到降维特征文字框;
    利用所述卷积神经网络中的全连接层输出所述降维特征文字框,得到特征文字框。
PCT/CN2021/083826 2021-01-19 2021-03-30 文字识别方法、装置、电子设备及存储介质 WO2022156066A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110068580.8A CN112861648B (zh) 2021-01-19 2021-01-19 文字识别方法、装置、电子设备及存储介质
CN202110068580.8 2021-01-19

Publications (1)

Publication Number Publication Date
WO2022156066A1 true WO2022156066A1 (zh) 2022-07-28

Family

ID=76007218

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/083826 WO2022156066A1 (zh) 2021-01-19 2021-03-30 文字识别方法、装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN112861648B (zh)
WO (1) WO2022156066A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115439850A (zh) * 2022-10-08 2022-12-06 招商局通商融资租赁有限公司 基于审单的图文字符识别方法、装置、设备及存储介质
CN115545009A (zh) * 2022-12-01 2022-12-30 中科雨辰科技有限公司 一种获取目标文本的数据处理***
CN116128458A (zh) * 2023-04-12 2023-05-16 华中科技大学同济医学院附属同济医院 用于医院经费卡报账的智能自动审核***

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112861648B (zh) * 2021-01-19 2023-09-26 平安科技(深圳)有限公司 文字识别方法、装置、电子设备及存储介质
CN113609274B (zh) * 2021-08-16 2024-02-09 平安银行股份有限公司 智能问答方法、装置、电子设备及存储介质
CN113673519B (zh) * 2021-08-24 2023-06-20 平安科技(深圳)有限公司 基于文字检测模型的文字识别方法及其相关设备
CN114330232A (zh) * 2021-12-29 2022-04-12 北京字节跳动网络技术有限公司 一种文本显示方法、装置、设备及存储介质
CN115620039B (zh) * 2022-10-08 2023-07-18 中电金信软件有限公司 一种图像标注方法、装置、设备和介质
CN116563875B (zh) * 2023-07-05 2023-09-08 四川集鲜数智供应链科技有限公司 一种具有加密功能的智能图文识别方法及***

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190026607A1 (en) * 2016-03-29 2019-01-24 Alibaba Group Holding Limited Character recognition method and device
CN111259878A (zh) * 2018-11-30 2020-06-09 中移(杭州)信息技术有限公司 一种检测文本的方法和设备
CN111325194A (zh) * 2018-12-13 2020-06-23 杭州海康威视数字技术股份有限公司 一种文字识别方法、装置及设备、存储介质
CN111414916A (zh) * 2020-02-29 2020-07-14 中国平安财产保险股份有限公司 图像中文本内容提取生成方法、装置及可读存储介质
CN112861648A (zh) * 2021-01-19 2021-05-28 平安科技(深圳)有限公司 文字识别方法、装置、电子设备及存储介质

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9659204B2 (en) * 2014-06-13 2017-05-23 Conduent Business Services, Llc Image processing methods and systems for barcode and/or product label recognition
CN104156706A (zh) * 2014-08-12 2014-11-19 华北电力大学句容研究中心 一种基于光学字符识别技术的中文字符识别方法
CN108460386B (zh) * 2018-03-19 2022-03-08 深圳怡化电脑股份有限公司 字符图像切割方法、装置、设备及存储介质
CN109492643B (zh) * 2018-10-11 2023-12-19 平安科技(深圳)有限公司 基于ocr的证件识别方法、装置、计算机设备及存储介质
CN110377686B (zh) * 2019-07-04 2021-09-17 浙江大学 一种基于深度神经网络模型的地址信息特征抽取方法
CN110766017B (zh) * 2019-10-22 2023-08-04 国网新疆电力有限公司信息通信公司 基于深度学习的移动终端文字识别方法及***
CN111782772A (zh) * 2020-07-24 2020-10-16 平安银行股份有限公司 基于ocr技术的文本自动生成方法、装置、设备及介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190026607A1 (en) * 2016-03-29 2019-01-24 Alibaba Group Holding Limited Character recognition method and device
CN111259878A (zh) * 2018-11-30 2020-06-09 中移(杭州)信息技术有限公司 一种检测文本的方法和设备
CN111325194A (zh) * 2018-12-13 2020-06-23 杭州海康威视数字技术股份有限公司 一种文字识别方法、装置及设备、存储介质
CN111414916A (zh) * 2020-02-29 2020-07-14 中国平安财产保险股份有限公司 图像中文本内容提取生成方法、装置及可读存储介质
CN112861648A (zh) * 2021-01-19 2021-05-28 平安科技(深圳)有限公司 文字识别方法、装置、电子设备及存储介质

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115439850A (zh) * 2022-10-08 2022-12-06 招商局通商融资租赁有限公司 基于审单的图文字符识别方法、装置、设备及存储介质
CN115439850B (zh) * 2022-10-08 2024-06-04 招商局智融供应链服务有限公司 基于审单的图文字符识别方法、装置、设备及存储介质
CN115545009A (zh) * 2022-12-01 2022-12-30 中科雨辰科技有限公司 一种获取目标文本的数据处理***
CN115545009B (zh) * 2022-12-01 2023-07-07 中科雨辰科技有限公司 一种获取目标文本的数据处理***
CN116128458A (zh) * 2023-04-12 2023-05-16 华中科技大学同济医学院附属同济医院 用于医院经费卡报账的智能自动审核***
CN116128458B (zh) * 2023-04-12 2024-02-20 华中科技大学同济医学院附属同济医院 用于医院经费卡报账的智能自动审核***

Also Published As

Publication number Publication date
CN112861648A (zh) 2021-05-28
CN112861648B (zh) 2023-09-26

Similar Documents

Publication Publication Date Title
WO2022156066A1 (zh) 文字识别方法、装置、电子设备及存储介质
CN109344831B (zh) 一种数据表识别方法、装置及终端设备
US10706320B2 (en) Determining a document type of a digital document
CN109416705B (zh) 利用语料库中可用的信息用于数据解析和预测
AU2020279921B2 (en) Representative document hierarchy generation
WO2022121171A1 (zh) 相似文本匹配方法、装置、电子设备及计算机存储介质
WO2022105179A1 (zh) 生物特征图像识别方法、装置、电子设备及可读存储介质
CN108491866B (zh) ***鉴定方法、电子装置及可读存储介质
WO2021208703A1 (zh) 问题解析方法、装置、电子设备及存储介质
WO2021151270A1 (zh) 图像结构化数据提取方法、装置、设备及存储介质
US10402640B1 (en) Method and system for schematizing fields in documents
CN111343162B (zh) ***安全登录方法、装置、介质及电子设备
US11495014B2 (en) Systems and methods for automated document image orientation correction
CN110019873B (zh) 人脸数据处理方法、装置及设备
CN111859093A (zh) 敏感词处理方法、装置及可读存储介质
US10242277B1 (en) Validating digital content rendering
CN113313114B (zh) 证件信息获取方法、装置、设备以及存储介质
CN112579781B (zh) 文本归类方法、装置、电子设备及介质
WO2022222228A1 (zh) 文本不良信息识别方法、装置、电子设备及存储介质
CN115858776A (zh) 一种变体文本分类识别方法、***、存储介质和电子设备
JP5885956B2 (ja) フォントマッチング
US11972208B2 (en) Information processing device and information processing method
CN110942068A (zh) 信息处理装置、存储介质及信息处理方法
CN113076485B (zh) 基于智能降级的资源推荐方法、装置、设备及存储介质
CN113888760B (zh) 基于软件应用的违规信息监控方法、装置、设备及介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21920454

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21920454

Country of ref document: EP

Kind code of ref document: A1