Text positioning method, device and electronic equipment

By dividing the image to be detected into regions and using a lightweight convolutional neural network to train the text line detection model, the key point regression detection of the upper and lower boundaries of the text line is used to solve the problem of low text line detection speed and accuracy in the existing technology. , realizing efficient text line detection on the mobile terminal.

CN113869306BActive Publication Date: 2024-10-29BEIJING SOGOU TECHNOLOGY DEVELOPMENT CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010623533.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-30
Publication Date
2024-10-29
Estimated Expiration
2040-06-30

AI Technical Summary

Technical Problem

The existing technology has low speed and accuracy in detecting Chinese text lines, which is especially unsuitable for mobile applications.

Method used

By dividing the image to be detected, a lightweight convolutional neural network is used to train and identify the text line detection model, and the key point regression detection of the upper and lower boundaries of the text line is used to simplify the detection task and improve the detection speed and accuracy.

Benefits of technology

It simplifies the detection task, improves the speed and accuracy of text line detection, reduces noise, and is suitable for mobile applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113869306B_ABST
    Figure CN113869306B_ABST
Patent Text Reader

Abstract

The present invention discloses a text positioning method, device and electronic device, the method comprising: dividing an image to be detected into regions to obtain n image regions, where n≥2; for each of the image regions, performing text recognition on the image region through a text line detection model, and if the image region is identified to contain text, performing key point regression detection on the upper and lower boundaries of the text line on the image region to obtain the key point coordinates of the upper and lower boundaries of the text line; based on the text recognition results of the n image regions and the key point coordinates of the upper and lower boundaries of the text line, obtaining the text image in the image to be detected. The above technical solution simplifies the detection task and improves the detection speed and accuracy by converting text line detection into key point detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software technology, and in particular to a text positioning method, device and electronic equipment. Background Art

[0002] Scanning pens are also called micro scanners or hand-scrape scanning pens. The size of a general scanning pen is only the size of a "folding fan" or smaller, which is convenient to carry and mobile office. Scanning pens are mainly used to scan office documents, texts, ID cards, business cards or large engineering drawings, etc., which better meets the needs of on-site scanning and on-site law enforcement, and are widely used in various fields.

[0003] Among them, text line detection is a common function of the scanning pen, which requires fast detection speed and high detection accuracy. Among the existing text line detection methods, the text line detection based on deep learning has high accuracy and supports text line detection in complex backgrounds, but the speed is slow and not suitable for running on mobile terminals. How to improve the speed and accuracy of text line detection has become a technical problem that needs to be solved urgently. Summary of the invention

[0004] The embodiments of the present invention provide a text positioning method, device and electronic device, which are used to solve the technical problem of low text line detection speed and accuracy in the prior art.

[0005] An embodiment of the present invention provides a text positioning method, the method comprising:

[0006] Divide the image to be detected into regions to obtain n image regions, where n≥2;

[0007] For each of the image regions, text recognition is performed on the image region using a text line detection model. If the image region is identified to contain text, key point regression detection of the upper and lower boundaries of the text line is performed on the image region to obtain the key point coordinates of the upper and lower boundaries of the text line;

[0008] Based on the text recognition results of the n image regions and the key point coordinates of the upper and lower boundaries of the text lines, a text image in the image to be detected is obtained.

[0009] Optionally, the text line detection model is a lightweight convolutional neural network.

[0010] Optionally, the training method of the text line detection model includes:

[0011] Get the text line scan image;

[0012] Dividing and marking the text line scanned image into regions to obtain a text area identifier representing whether each image region contains text and key points representing upper and lower boundaries of the text line of the image region containing text;

[0013] Obtaining a training sample based on the text line scan image, the text area identifier and the key point;

[0014] The text line detection model is trained based on the multiple training samples.

[0015] Optionally, the performing model training on the text line detection model based on the plurality of training samples includes:

[0016] The text line detection model is trained based on the plurality of training samples and an angle loss function, wherein the angle loss function is used to constrain the positional relationship between the key points.

[0017] Optionally, obtaining the text image in the image to be detected based on the text recognition results of the n image regions and the key point coordinates of the upper and lower boundaries of the text lines includes:

[0018] According to the text recognition results of the n image regions, obtaining the leftmost text region and the rightmost text region of the image to be detected;

[0019] Obtaining left and right boundaries of the text line according to the leftmost text area, the rightmost text area, and an image area of ​​a preset length;

[0020] Based on the key point coordinates of the left and right boundaries of the text line and the upper and lower boundaries of the text line, a text image in the image to be detected is obtained.

[0021] The embodiment of the present invention further provides a text positioning device, the device comprising:

[0022] A region division unit is used to divide the image to be detected into regions to obtain n image regions, where n≥2;

[0023] A detection unit, configured to perform text recognition on each of the image regions by using a text line detection model, and if the image region is identified to contain text, perform key point regression detection on the upper and lower boundaries of the text line on the image region to obtain the key point coordinates of the upper and lower boundaries of the text line;

[0024] The extraction unit is used to obtain the text image in the image to be detected based on the text recognition results of the n image areas and the key point coordinates of the upper and lower boundaries of the text line.

[0025] Optionally, the text line detection model is a lightweight convolutional neural network.

[0026] Optionally, the device further comprises a training unit, configured to:

[0027] Get the text line scan image;

[0028] Dividing and marking the text line scanned image into regions to obtain a text area identifier representing whether each image region contains text and key points representing upper and lower boundaries of the text line of the image region containing text;

[0029] Obtaining a training sample based on the text line scan image, the text area identifier and the key point;

[0030] The text line detection model is trained based on the multiple training samples.

[0031] Optionally, the training unit is further used for:

[0032] The text line detection model is trained based on the plurality of training samples and an angle loss function, wherein the angle loss function is used to constrain the positional relationship between the key points.

[0033] Optionally, the extraction unit is used to:

[0034] According to the text recognition results of the n image regions, obtaining the leftmost text region and the rightmost text region of the image to be detected;

[0035] Obtaining left and right boundaries of the text line according to the leftmost text area, the rightmost text area, and an image area of ​​a preset length;

[0036] Based on the key point coordinates of the left and right boundaries of the text line and the upper and lower boundaries of the text line, a text image in the image to be detected is obtained.

[0037] The above one or more technical solutions in the embodiments of the present application have at least the following technical effects:

[0038] The embodiment of the present application provides a text positioning method, which divides the image to be detected into regions to obtain n image regions; for each image region, the image region is subjected to text recognition through a text line detection model; if the image region is identified to contain text, the image region is subjected to key point regression detection of the upper and lower boundaries of the text line to obtain the key point coordinates of the upper and lower boundaries of the text line, that is, the text line detection is converted into a key point detection problem through text region recognition and key point regression detection, which simplifies the detection task and makes the detection process simple and fast; thus, the text image in the image to be detected is obtained based on the text region recognition results of the n image regions and the key point coordinates of the upper and lower boundaries of the text line. Since the key point detection task is relatively simple, the speed of text line detection is greatly improved, and through the key point regression detection of the upper and lower boundaries of the text line, the key points obtained are close to the text line, and the upper and lower noises of the detected text image are small, which effectively improves the text recognition accuracy and solves the technical problems of low text line detection speed and accuracy in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A flowchart of a text positioning method provided in an embodiment of the present application;

[0040] Figure 2 A block diagram of a text positioning device provided in an embodiment of the present application;

[0041] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] In the technical solution provided in the embodiment of the present application, a text positioning method is provided, which simplifies the text line detection task and improves the text line detection accuracy through key point regression detection of the upper and lower boundaries of the text line, thereby solving the technical problems of low text line detection speed and accuracy in the prior art.

[0043] The main implementation principles, specific implementation methods and corresponding beneficial effects of the technical solutions of the embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0044] Example

[0045] The present application embodiment provides a text positioning method, which is applicable to text line detection, and is particularly applicable to text line detection by a scanning pen. Figure 1 , the text positioning method includes:

[0046] S11, dividing the image to be detected into regions to obtain n image regions, where n≥2;

[0047] S13, for each of the image regions, performing text recognition on the image region using a text line detection model, and if the image region is identified to contain text, performing key point regression detection on the upper and lower boundaries of the text line on the image region to obtain the key point coordinates of the upper and lower boundaries of the text line;

[0048] S15. Obtain a text image in the image to be detected based on the text area recognition results of the n image areas and the key point coordinates of the upper and lower boundaries of the text lines.

[0049] In the specific implementation process, before or after S11, the image to be detected can be preprocessed, including image normalization, standardization, etc. When S11 performs region division, the image to be detected can be equally divided into several image regions in the horizontal direction, recorded as {x0; x1; x2...xn}. Among them, n can take different values ​​such as 16 and 32, which can be set according to the reduction factor of the final feature map of the text line detection model or the actual situation.

[0050] After preprocessing and area division, execute S13 to input the image after preprocessing and area division into a text line detection model, and perform text recognition and key point regression detection through the text line detection model. Among them, text recognition refers to classifying whether the current image area contains text. Key point regression detection refers to performing regression detection on the positions of the upper and lower boundaries of the text line, and finally outputting the key point coordinates of the upper and lower boundaries of the text line in the image area classified as text, that is, the key point coordinates of the upper boundary of the text line and the key point coordinates of the lower boundary of the text line. During the key point regression detection, the upper and lower boundary positions can be specifically firstly regressed, and then the upper and lower boundary points corresponding to the middle point of the image area are obtained as the key points of the image area, and then the key point coordinates are obtained.

[0051] After S13, S15 is further executed to obtain the text image in the image to be detected based on the text recognition results of the n image regions and the key point coordinates of the upper and lower boundaries of the text lines. Specifically, the key point coordinates of the image region containing the text in the n image regions are converted, such as connecting the key points of all the upper boundaries of the text and connecting the key points of all the lower boundaries of the text lines, so as to obtain the text line position, and then obtain the text image in the image to be detected through image post-processing. Since the text line position obtained by the key points is relatively accurate, a variety of post-processing methods can be used to obtain the final text image, such as using the minimum circumscribed rectangle to obtain a rectangular frame containing the text line area, and then according to the area of ​​the text line, only the content in the text line area is retained, and the remaining position is whitened (to reduce noise), and finally the perspective transformation is used to pull it into a horizontal frame, which is the final text image.

[0052] During the specific implementation process, in order to further improve the accuracy of the left and right boundaries of the text line, S15 can also first obtain the leftmost text area and the rightmost text area of ​​the image to be detected based on the text recognition results of n image areas. For example, if the image area division is horizontally divided from left to right, then the image area containing text on the left is the leftmost text area, and the image area containing text on the right is the rightmost text area. Further, based on the leftmost text area, the rightmost text area and the image area of ​​a preset length, the left and right boundaries of the text line are obtained, such as expanding the image area of ​​a preset length outside the left boundary of the leftmost text area to obtain the left boundary of the text line, and the right boundary is the same. Finally, based on the key point coordinates of the left and right boundaries of the text line and the upper and lower boundaries of the text line, the text image in the image to be detected is obtained.

[0053] The present embodiment provides text line key point regression detection for each image area, which greatly simplifies the task of text line detection and can greatly reduce the requirements for the text line detection model. For this reason, the text line detection model of the present embodiment can be implemented using a deep learning algorithm, such as using a lightweight convolutional neural network as a text line detection model. The lightweight convolutional neural network is simple, fast and highly accurate, and because it uses a deep learning algorithm, it supports text line detection in complex backgrounds. Specifically, the lightweight convolutional neural network can be a convolutional neural network obtained based on Depthwise convolution, such as ShuffleNet, EfficientNet, etc.

[0054] Among them, the training method of the text line detection model can first obtain a text line scan image. If it is for text line detection with a scanning pen, then obtain a scan image obtained by scanning with a scanning pen. Subsequently, the text line scan image is divided and marked to obtain a text area identifier representing whether each image area contains text and key points representing the upper and lower boundaries of the text line of the image area containing text. After marking, a training sample is obtained based on the text line scan image, the text area identifier and the key points, that is, the text line scan image or the preprocessed text line scan image is used as input data, and the text area identifier and the key points are used as annotations of the text scan image. Finally, the text line detection model is trained based on multiple training samples. It should be noted that due to the simplification of the detection task of the text line detection model, the demand for the number of training samples is reduced, the load of the model is simplified, and it is more suitable for use on mobile terminals.

[0055] Based on the text line detection model using a deep learning algorithm, this embodiment uses a data-driven approach to further improve the accuracy of text line detection and multi-line text detection in complex backgrounds. Specifically, for text line detection in complex backgrounds, text line scanned images of various backgrounds can be obtained as training samples. Through multi-background sample training, the model can learn and identify the position of text lines in complex backgrounds. For the problem of multi-line text line detection, the central text can be manually marked during labeling. Through multi-line text line sample training, the model can automatically learn the central line where the user's intention is, solving the problem of multi-line text detection.

[0056] In order to solve the problem of text line detection noise, this embodiment detects the key points at the upper and lower boundaries of the text line, and the detected key points are close to the text line, so that the upper and lower noise of the detected text image is small, which effectively improves the accuracy of text line detection. On the other hand, when training the text line detection model, this embodiment also trains the text line detection model based on multiple training samples and an angle loss function, wherein the angle loss function is used to constrain the positional relationship between key points. Specifically, the angle loss function can refer to the following formula:

[0057] lossangle=smoothL1Loss(arctan(y) / (pi / 2)),tanh(y'))

[0058] Where y is the slope between adjacent key points, arctan(y) / (pi / 2) is to normalize y to the interval (-1, 1), tanh(y') is the normalized angle predicted by the detection model, and tanh is the activation function of the convolutional neural network. In the training process of the text line detection model, the positional relationship between the key points of the model is added with angle constraints, so that the position of the key points is more closely aligned with the text position, thereby reducing excess noise.

[0059] Based on the text positioning method provided by the above embodiment, on the one hand, in order to solve the problem that both accuracy and speed cannot be guaranteed at the same time, a text line detection algorithm based on key points is proposed to simplify the task, and a lightweight network design is adopted to ensure high accuracy and extremely fast speed. On the second hand, the detection algorithm based on deep learning in this embodiment supports text line detection in complex backgrounds, and performs text line detection based on a lightweight convolutional neural network, supports detection in various scenarios, especially text line detection on mobile terminals, and has high robustness. On the third hand, in order to solve the problem of how to locate user intention in multi-line scenarios, data-driven and artificial labels are used to accurately select text lines that are closer to the center, so that the detected text line results are basically consistent with the user intention. On the fourth hand, in order to solve the problem that the text box detected by the traditional method is tilted and contains too much upper and lower noise, the key point inspection method and the angle constraint between the key points enable the method to predict a more accurate text boundary position and extract a text image that contains almost no upper and lower noise.

[0060] A text positioning method is provided in the above embodiment. The present application also provides a text positioning device. Figure 2 , the device comprises:

[0061] A region division unit 21 is used to divide the image to be detected into regions to obtain n image regions, where n≥2;

[0062] A detection unit 22 is used to perform text recognition on each of the image regions by using a text line detection model, and if the image region is identified to contain text, perform key point regression detection on the upper and lower boundaries of the text line on the image region to obtain the key point coordinates of the upper and lower boundaries of the text line;

[0063] The extraction unit 23 is used to obtain the text image in the image to be detected based on the text recognition results of the n image regions and the key point coordinates of the upper and lower boundaries of the text line.

[0064] Among them, the text line detection model can be a lightweight convolutional neural network.

[0065] As an optional implementation, the device further includes a training unit 24, which is used to:

[0066] Obtain a text line scan image; divide and mark the text line scan image into regions to obtain a text area identifier representing whether each image region contains text and key points representing the upper and lower boundaries of the text line of the image region containing text; obtain training samples based on the text line scan image, the text area identifier and the key points; and train the text line detection model based on a plurality of the training samples.

[0067] As an optional implementation, the training unit 24 is further used to: perform model training on the text line detection model based on the multiple training samples and the angle loss function, wherein the angle loss function is used to constrain the positional relationship between the key points.

[0068] As an optional embodiment, the extraction unit 23 is used to: obtain the leftmost text area and the rightmost text area of ​​the image to be detected based on the text recognition results of n image areas; obtain the left and right boundaries of the text line based on the leftmost text area, the rightmost text area and the image area of ​​a preset length; obtain the text image in the image to be detected based on the key point coordinates of the left and right boundaries of the text line and the upper and lower boundaries of the text line.

[0069] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0070] Figure 3 1 is a block diagram of an electronic device 800 for implementing a text positioning method according to an exemplary embodiment. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0071] Reference Figure 3 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / display (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0072] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0073] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0074] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

[0075] The multimedia component 808 includes a screen that provides a display interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0076] The audio component 810 is configured to present and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for presenting audio signals.

[0077] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0078] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0079] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0080] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0081] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0082] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of a mobile terminal, enables the mobile terminal to perform a text positioning method, the method comprising:

[0083] Divide the image to be detected into regions to obtain n image regions, where n≥2;

[0084] For each of the image regions, text recognition is performed on the image region using a text line detection model. If the image region is identified to contain text, key point regression detection of the upper and lower boundaries of the text line is performed on the image region to obtain the key point coordinates of the upper and lower boundaries of the text line;

[0085] Based on the text recognition results of the n image regions and the key point coordinates of the upper and lower boundaries of the text lines, a text image in the image to be detected is obtained.

[0086] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.

[0087] It should be understood that the present invention is not limited to the precise structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

[0088] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A text positioning method, characterized in that: The method comprises: Divide the image to be detected horizontally from left to right to obtain n image regions, where n≥2; For each of the image regions, text recognition is performed on the image region using a text line detection model. If the image region is identified to contain text, key point regression detection of the upper and lower boundaries of the text line is performed on the image region to obtain the key point coordinates of the upper and lower boundaries of the text line; Based on the text recognition results of the n image regions and the key point coordinates of the upper and lower boundaries of the text lines, obtaining a text image in the image to be detected; The step of obtaining the text image in the image to be detected based on the text recognition results of the n image regions and the key point coordinates of the upper and lower boundaries of the text lines comprises: According to the text recognition results of the n image regions, obtaining the leftmost text region and the rightmost text region of the image to be detected; According to the leftmost text area, the rightmost text area and the image area of ​​preset length, the left boundary of the leftmost text area is expanded by the image area of ​​preset length to obtain the left boundary of the text line, and the right boundary of the rightmost text area is expanded by the image area of ​​preset length to obtain the right boundary of the text line; Based on the key point coordinates of the left and right boundaries of the text line and the upper and lower boundaries of the text line, a text image in the image to be detected is obtained.

2. The method according to claim 1, characterized in that The text line detection model is a lightweight convolutional neural network.

3. The method according to claim 1, characterized in that The training method of the text line detection model includes: Get the text line scan image; Dividing and marking the text line scanned image into regions to obtain a text area identifier representing whether each image region contains text and key points representing upper and lower boundaries of the text line of the image region containing text; Obtaining a training sample based on the text line scan image, the text area identifier and the key point; The text line detection model is trained based on the multiple training samples.

4. The method according to claim 3, characterized in that The performing model training on the text line detection model based on the plurality of training samples comprises: The text line detection model is trained based on the plurality of training samples and an angle loss function, wherein the angle loss function is used to constrain the positional relationship between the key points.

5. A text positioning device, characterized in that: The device comprises: A region division unit is used to divide the image to be detected horizontally from left to right to obtain n image regions, where n≥2; A detection unit, configured to perform text recognition on each of the image regions by using a text line detection model, and if the image region is identified to contain text, perform key point regression detection on the upper and lower boundaries of the text line on the image region to obtain the key point coordinates of the upper and lower boundaries of the text line; An extraction unit, used for obtaining a text image in the image to be detected based on the text recognition results of the n image regions and the key point coordinates of the upper and lower boundaries of the text lines; The extraction unit is used for: According to the text recognition results of the n image regions, obtaining the leftmost text region and the rightmost text region of the image to be detected; According to the leftmost text area, the rightmost text area and the image area of ​​preset length, the left boundary of the leftmost text area is expanded by the image area of ​​preset length to obtain the left boundary of the text line, and the right boundary of the rightmost text area is expanded by the image area of ​​preset length to obtain the right boundary of the text line; Based on the key point coordinates of the left and right boundaries of the text line and the upper and lower boundaries of the text line, a text image in the image to be detected is obtained.

6. The device according to claim 5, characterized in that The text line detection model is a lightweight convolutional neural network.

7. The device according to claim 5, characterized in that The device also includes a training unit, which is used to: Get the text line scan image; Dividing and marking the text line scanned image into regions to obtain a text area identifier representing whether each image region contains text and key points representing upper and lower boundaries of the text line of the image region containing text; Obtaining a training sample based on the text line scan image, the text area identifier and the key point; The text line detection model is trained based on the multiple training samples.

8. An electronic device, characterized in that: The invention comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute the operation instructions corresponding to the method according to any one of claims 1 to 4 contained in the one or more programs.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps corresponding to the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Text area recognition method and device, terminal equipment and readable storage medium

    CN111062258A

  • License plate recognition method and device, electronic equipment and storage medium

    CN112990197A

  • Text recognition method for natural scene, readable storage medium and text recognition device

    CN114220108A