WO2023147717A1 - 文字检测方法、装置、电子设备和存储介质 - Google Patents

文字检测方法、装置、电子设备和存储介质 Download PDF

Info

Publication number
WO2023147717A1
WO2023147717A1 PCT/CN2022/109024 CN2022109024W WO2023147717A1 WO 2023147717 A1 WO2023147717 A1 WO 2023147717A1 CN 2022109024 W CN2022109024 W CN 2022109024W WO 2023147717 A1 WO2023147717 A1 WO 2023147717A1
Authority
WO
WIPO (PCT)
Prior art keywords
bounding box
text
information
initial bounding
position information
Prior art date
Application number
PCT/CN2022/109024
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 WO2023147717A1 publication Critical patent/WO2023147717A1/zh

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
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • 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
    • G06V30/16Image preprocessing
    • 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
    • G06V30/16Image preprocessing
    • G06V30/162Quantising the image signal

Definitions

  • the present disclosure relates to the technical field of artificial intelligence, specifically to the field of deep learning, the field of character recognition and the field of image processing. More specifically, it relates to a character detection method, device, electronic equipment and storage medium.
  • deep learning technology can be used to detect the text in the image, and locate the text area in the image, so as to recognize the text in the image.
  • the present disclosure aims to provide a text detection method, device, electronic equipment and storage medium for improving detection efficiency.
  • a text detection method including: detecting a binary image representing the area where the text is located in the image to be processed, and obtaining contour information of the area where the text is located; determining an initial bounding box for the text according to the contour information position information; determine the side extension value for the initial bounding box according to the position information; and extend the side of the initial bounding box according to the side extension value to obtain the position information of the bounding box used to recognize the text.
  • a text detection device including: an image detection module, configured to detect a binary image representing the area where the text is located in the image to be processed, and obtain contour information of the area where the text is located; a position determination module, It is used to determine the position information of the initial bounding box for the text according to the outline information; the value determination module is used to determine the side extension value of the initial bounding box according to the position information; and the position acquisition module is used to extend the initial bounding box according to the side extension value The edge of the frame to obtain the position information of the bounding box used to recognize the text.
  • an electronic device including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are Execution by at least one processor, so that at least one processor can execute the text detection method provided by the present disclosure.
  • a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the text detection method provided in the present disclosure.
  • a computer program product including a computer program/instruction, and when the computer program/instruction is executed by a processor, the text detection method provided in the present disclosure is implemented.
  • FIG. 1 is a schematic diagram of an application scenario of a character detection method and device according to an embodiment of the present disclosure
  • FIG. 2 is a schematic flow diagram of a text detection method according to an embodiment of the present disclosure
  • Fig. 3 is a schematic diagram of the principle of extending the sides of an initial bounding box according to an embodiment of the present disclosure
  • FIG. 4 is a schematic diagram of the principle of a text detection method according to an embodiment of the present disclosure.
  • FIG. 5 is a structural block diagram of a text detection device according to an embodiment of the disclosure.
  • FIG. 6 is a block diagram of an electronic device for implementing the text detection method of the embodiment of the present disclosure.
  • the present disclosure provides a text detection method, which includes a graph detection stage, a position determination stage, an extension value determination stage and a position acquisition stage.
  • the image detection stage detect the binary image representing the area where the text is located in the image to be processed, and obtain the contour information of the area where the text is located.
  • the position determination stage the position information of the initial bounding box for the text is determined based on the outline information.
  • the side extension value for the initial bounding box is determined according to the position information.
  • the positions of the initial bounding box are extended according to the side extension value to obtain the position information of the bounding box used for character recognition.
  • Fig. 1 is a schematic diagram of an application scenario of a text detection method and device according to an embodiment of the disclosure.
  • the application scenario 100 of this embodiment may include an electronic device 110, which may be various electronic devices with processing functions, including but not limited to smart phones, tablet computers, laptop computers, Desktop computers and servers and more.
  • the electronic device 110 may, for example, perform character detection on the input image 120 to obtain a character bounding box 130 .
  • the text included in the image 120 can be obtained by performing text recognition on the image within the text enclosing frame 130 .
  • the electronic device 110 may use character recognition technology (such as optical character recognition technology OCR, etc.) to perform character recognition on the image within the character bounding box 130 .
  • character recognition technology such as optical character recognition technology OCR, etc.
  • the electronic device 110 may perform text detection by means of a text detection algorithm 140 to obtain a text bounding box 130 .
  • the text detection algorithm 140 may be a regression-based detection algorithm or a segmentation-based detection algorithm.
  • the regression-based detection algorithm may include, for example, a Textboxes algorithm, a Textboxes++ algorithm, or a Rotational Region CNN (R2CNN) algorithm, and the like.
  • the segmentation-based detection algorithm may include Pixel-Link algorithm, Progressive Scale Expansion Network (PSENet), Differentiable Binarization Network (DBNet), etc.
  • the text detection algorithm 140 may be provided by the server 150 .
  • the electronic device 110 may communicate with the server 150 through a network, so as to send an algorithm acquisition request to the server 150 .
  • the server 150 may send the text detection algorithm 140 to the electronic device 110 in response to the algorithm acquisition request.
  • the server 150 can also be used to train the deep learning network model, and send the trained deep learning network model in response to the algorithm acquisition request.
  • the electronic device 110 may also send the input image 120 to the server 150, and the server 150 performs text detection on the image 120 to obtain a text enclosing frame, and recognize the text in the text enclosing frame.
  • the text detection method provided in the present disclosure may be executed by the electronic device 110 or by the server 150 .
  • the character detection apparatus provided in the present disclosure may be set in the electronic device 110 or in the server 150 .
  • FIG. 2 is a schematic flowchart of a character detection method according to an embodiment of the disclosure.
  • the character detection method 200 of this embodiment includes operation S210 to operation S240 .
  • a binary image representing the area where the text is located in the image to be processed is detected to obtain contour information of the area where the text is located.
  • the image to be processed is an image including text.
  • images to be processed can be obtained by photographing billboards, trademarks, cars, invoices and other entities with text.
  • pre-generated binary images can be obtained for detection.
  • a segmentation-based text detection algorithm may be used to detect the image to be processed to obtain a binary image representing the area where the text is located.
  • the pixels whose value is not 0 in the binary image are the pixels where the text is located, and the area formed by all the pixels where the text is located can be used as the area where the text is located.
  • this embodiment may scan each pixel in the binary image, and determine whether the value of four adjacent pixels to each pixel includes a pixel that is 0. If it includes a pixel point of 0, each pixel point is regarded as a contour point; otherwise, each pixel point is determined as a point inside the contour or a point outside the contour.
  • the target region formed by connecting the contour points in the binary image can be used as the region where the text is located, and the coordinate values of the contour points connected to form the target region in the binary image can be used as the contour information of the region where the text is located .
  • the target area refers to an area in which the value of the pixel points in the area is not 0.
  • position information of an initial bounding box for the text is determined according to the outline information.
  • the minimum circumscribed rectangular frame of the target area described above may be used as the initial bounding frame for the text.
  • this embodiment may determine two contour points located at both ends in the width direction of the binary map and two contour points located at both ends in the height direction of the binary map among the contour points connected to form the target area. Then, the determined four contour points are used as four target contour points, and a rectangular frame whose four sides respectively pass through the four target contour points is used as an initial bounding box.
  • the coordinate values of the four vertices of the rectangular frame in the binary image may be used as the position information of the initial bounding box, or the coordinate values of the four contour points in the binary image may be used as the position information of the initial bounding box.
  • a side extension value for the initial bounding box is determined according to the location information.
  • the width and height of the initial bounding frame may be determined according to the position information.
  • the root mean square of this width and height can then be used as the edge extension value.
  • the product of the width and the predetermined ratio may be used as the side extension value in the width direction of the initial bounding box, and the product of the height and the predetermined ratio may be used as the side extension value in the height direction of the initial bounding box.
  • the predetermined ratio can be set according to actual needs.
  • the edge of the initial bounding box can be extended.
  • the two endpoints of each side may be extended in opposite directions by the same length to obtain the extended side.
  • multiple extended sides can be obtained.
  • all endpoints of multiple extended sides can be connected to obtain a bounding box for character recognition. That is, the outline of the bounding box for recognizing characters passes through all endpoints of the plurality of extended sides.
  • the coordinate values of all the end points of the multiple extended sides in the binary image may be used as the position information of the bounding box for character recognition.
  • the side extension value is determined according to the position information of the initial bounding box, and the side of the initial bounding box is extended according to the extension value to obtain the position information of the bounding box used for character recognition, which can make the determined character recognition
  • the bounding box can better cover the area where the text in the image to be processed is located. This is because, when detecting the image to be processed to obtain a binary image, in order to make the binary image better reflect different text lines, the area where the text is located is often reduced to a certain extent, then the text represented by the binary image The area cannot completely cover the text.
  • both the contour information of the text area obtained by detecting the binary image and the initial bounding box determined according to the contour information cannot completely reflect the text area.
  • the text detection method provided by the embodiment of the present disclosure extends the side of the initial bounding box according to the determined side extension value, and obtains the text bounding box based on the extended side, which can achieve the purpose of enlarging the bounding box and improve the recognition of text.
  • the purpose of the accuracy of the bounding box Compared with calling a graphics processing library (such as Clipper library, etc.) to process binary images, and thus obtain a technical solution for recognizing text bounding boxes, it can simplify the processing process, reduce the amount of calculation and resource usage, and improve processing efficiency .
  • the processing logic of the text detection method provided by this embodiment can be deployed on devices with limited computing performance, such as terminal devices, which is beneficial to improve the robustness of the text detection method.
  • the contour detection function can be called to detect the binary image, so as to obtain the contour information of the area where the text is located.
  • the contour detection function may be a function in a computer vision library, and the computer vision library may include OpenCV and the like.
  • the contour detection function can be the findContours function.
  • OpenCV is an Internet open source computer vision library, which consists of a series of C functions and a small number of C++ classes. It can be understood that the above-mentioned OpenCV is only used as an example to facilitate understanding of the present disclosure, and any lightweight computer vision library can be used in the present disclosure, which is not limited in the present disclosure.
  • a binary image can be used as the value of the image parameter in the findContours function, and a vector is obtained after being processed by the findContours function, and the vector includes at least one point set, and each point set corresponds to a contour. It can be understood that the points included in each point set are similar to the contour points described above, and will not be repeated here.
  • the minimum enclosing rectangle function may be called to determine the position information of the initial bounding box for the text.
  • the minimum circumscribed rectangle function may be a function in a computer vision library.
  • the minimum circumscribed rectangle function may be the minAreaRect function.
  • each point set described above can be used as the input of the minAreaRect function, and after being processed by the minAreaRect function, the coordinate values of the four vertices of the rectangle are output.
  • the rectangle is the initial bounding box, and the coordinate values of the four vertices can be used as the position information of the initial bounding box.
  • the rectangle obtained by using the minAreaRect function can be determined by the deflection angle. That is, the included angle between each side of the rectangle and the width direction of the binary image and the included angle between each side and the height direction of the binary image are not zero.
  • the outline information of the area where the text is located and the position information of the initial bounding box are obtained by calling functions in the computer vision library, so that the processing logic of the text detection method can be implemented by using codes with high operating efficiency such as C++ codes.
  • codes with high operating efficiency such as C++ codes.
  • Fig. 3 is a schematic diagram of the principle of obtaining a bounding box for character recognition according to an embodiment of the present disclosure.
  • the size information of the initial bounding box may first be determined according to the position information of the initial bounding box. Then determine the side extension value for the initial bounding box according to the size information and the predetermined extension coefficient.
  • the expansion range of the initial bounding box can be flexibly adjusted according to actual needs, so as to make the obtained bounding box for character recognition more in line with actual needs.
  • the determined size information of the initial bounding box may include the width and height of the initial bounding box.
  • the product of the height and the predetermined extension coefficient may be used as the side extension value of the sides in the height direction of the initial bounding box, and the product of the width and the predetermined extension coefficient may be used as the side extension value of the sides of the initial bounding box in the width direction.
  • the predetermined extension coefficient may be set according to actual requirements, which is not limited in the present disclosure.
  • the determined size information of the initial bounding box may include a perimeter and an area of the initial bounding box.
  • a method similar to the calculation method of the offset coefficient D' of the Vatti Clipping algorithm can be used to determine the side extension value according to the perimeter and the area.
  • the ratio of the area to the perimeter can be determined first, and the product of the ratio and a predetermined extension coefficient can be used as the edge extension value.
  • the principle of the text detection method in the embodiment of the present disclosure can be more suitable for the detection method implemented by relying on the Clipper library. In this way, while improving the processing efficiency, the obtained bounding box used for character recognition can be made closer to the bounding box obtained through complicated processing, thereby ensuring the detection accuracy.
  • the position information of the initial bounding box is set to be represented by the coordinate values of four vertices in the binary image, the area of the initial bounding box is A, the perimeter of the initial bounding box is P, and the side extension value is d, then d
  • d it can be calculated by the following formula:
  • unclip_ratio may be a hyperparameter, which is used to adjust the extent of bounding box expansion, and the value of the hyperparameter may be, for example, 1.5, etc., which is not limited in the present disclosure.
  • the area A of the initial bounding box can be calculated using the following formula:
  • x 1 , ..., x n respectively represent the coordinate values of the horizontal axis of each of the four vertices in the coordinate system based on the binary image
  • y 1 , ..., y n respectively represent the four vertices in the coordinate system based on the binary image
  • n is 4.
  • the determined side extension value may be a value of side extension in one direction. This embodiment allows the sides to be extended in two opposite directions.
  • the four vertices of the initial bounding box 301 are respectively set as p_0 , p_1 , p_2 , and p_3 , and the side extension value is determined to be d.
  • the side of the initial bounding box may be extended based on the extension value first, to obtain position information of the extended side. Then, according to the position information behind the extension, the position information of the enclosing frame used to recognize the character is determined.
  • the edge formed by connecting the vertex p_0 and the vertex p_1 in the initial bounding box 301 the edge is extended in two opposite directions by d, and the extended edge obtained is the edge formed by connecting the point 311 and the point 312 .
  • the edge formed by connecting the vertex p_0 and the vertex p_3 in the initial bounding box the edge is extended in two opposite directions by d, and the extended edge obtained is the edge formed by connecting the point 313 and the point 314 .
  • the position information of the extended side corresponding to each side can be represented by the coordinate values of two points obtained by extending each side.
  • the position information of the extended rear edge can be represented by the coordinate value of the point 313 and the coordinate value of the point 314 .
  • the obtained 8 points can constitute four point groups respectively close to the vertices p_0, p_1, p_2, p_3, and each point group includes two points.
  • the point group near the vertex p_0 includes point 311 and point 313 .
  • each vertex and two points in a point group close to each vertex may be determined as three vertices to determine a rectangular frame.
  • another vertex in the determined rectangular frame except for the three vertices may be used as a vertex of the bounding frame used for character recognition.
  • a vertex of the bounding box for recognizing text can be obtained by using a similar method, and a total of four vertices of the bounding box for recognizing text can be obtained, thereby obtaining A bounding box 302 for the text.
  • the location information of the bounding box 302 may be represented by the coordinate values of the four vertices of the bounding box 302 .
  • the coordinate values of the 8 points can be used to form a point set, and the formed point set can be used as the input of the minAreaRect function described above.
  • the output can be used Based on the coordinate values of the four vertices of the bounding box 302 for recognizing the text, position information of the bounding box for recognizing the text is obtained.
  • FIG. 4 is a schematic diagram of the principle of a text detection method according to an embodiment of the disclosure.
  • the image to be processed 401 may be detected first, so as to obtain a binary image representing the region where the character is located.
  • this embodiment may use a segmentation-based (Segmentation-based) text detection algorithm to detect the image 401 to be processed.
  • DBNet 410 the text detection algorithm as DBNet 410
  • this embodiment can input the image 401 to be processed into DBNet 410, and extract features through the backbone network (Backbone) in DBNet 410 to obtain the feature map F.
  • DBNet 410 can simultaneously predict a probability map (probability map) P 402 and a threshold map (threshold map) T 403 according to the feature map F.
  • this embodiment can use the predicted probability map P 402 output by the DBNet 410 as a binary image B 404.
  • the binary image needs to be calculated according to the predicted probability P and the threshold map T to calculate the binary image B.
  • the following formula can be used to calculate:
  • k is an expansion factor, which can be set according to experience.
  • P i, j is the element value of row i and column j in the predicted probability map P, and each probability element in the predicted probability map P represents the probability that the pixel corresponding to each element in the image to be processed represents text.
  • T i, j is the element value of row i and column j in the threshold map T, and each element in the threshold map P represents the threshold for the pixel corresponding to each element in the image to be processed.
  • the binary image B 404 can be post-processed to obtain the position information of the bounding box 405 used for character recognition.
  • the post-processing may be implemented through operation S210 to operation S240 described above in FIG. 2 , which will not be repeated here.
  • the text detection method of this embodiment can accurately detect curved text and adjacent text in natural scenes. Since DBNet uses a dynamic threshold to divide the text area and non-text area in the image to be processed, using DBNet to detect the image to be processed can improve the detection accuracy and detection efficiency of the text detection method to a certain extent. The reason why DBNet can use a dynamic threshold to divide the area where text is located and the area where non-text is located is because DBNet is a deep learning network. DBNet can continuously adjust the threshold map T when it obtains the threshold map T according to the feature map F through continuous learning of image features. The network parameters involved.
  • the present disclosure also provides a character detection device.
  • the device will be described in detail below with reference to FIG. 5 .
  • FIG. 5 is a structural block diagram of a character detection device according to an embodiment of the disclosure.
  • the text detection device 500 of this embodiment may include a graph detection module 510 , a position determination module 520 , a value determination module 530 and a position acquisition module 540 .
  • the image detection module 510 is used to detect the binary image representing the area where the text is located in the image to be processed, and obtain the contour information of the area where the text is located.
  • the image detection module 510 may be configured to perform the operation S210 described above, which will not be repeated here.
  • the position determination module 520 is used to determine the position information of the initial bounding box for the text according to the outline information.
  • the location determining module 520 may be configured to perform the operation S220 described above, which will not be repeated here.
  • the value determination module 530 is used to determine the side extension value for the initial bounding box according to the location information. In an embodiment, the value determination module 530 may be used to perform the operation S230 described above, which will not be repeated here.
  • the position obtaining module 540 is configured to extend the sides of the initial bounding box according to the side extension value, and obtain the position information of the bounding box used for character recognition.
  • the value determination module 530 may be configured to perform the operation S240 described above, which will not be repeated here.
  • the above-mentioned value determination module 530 may include a size determination sub-module and an extension value determination sub-module.
  • the size determination sub-module is used to determine the size information of the initial bounding box according to the position information.
  • the extension value determination sub-module is used to determine the side extension value for the initial bounding box according to the size information and the predetermined extension coefficient.
  • the size determination module is specifically configured to determine the perimeter of the initial bounding box and the area of the initial bounding box according to the location information.
  • the position obtaining module 540 may include a side extension sub-module and a position determination sub-module.
  • the edge extension sub-module is used to extend the edge of the initial bounding box based on the edge extension value to obtain the position information of the extended edge.
  • the position determination sub-module is used to determine the position information of the bounding box for the text according to the position information of the extended side, as the position information of the bounding box for identifying the text.
  • the text detection device 500 may further include a binary image obtaining module, configured to detect an image to be processed using a segmentation-based text detection algorithm, and obtain a binary image representing the area where the text is located.
  • a binary image obtaining module configured to detect an image to be processed using a segmentation-based text detection algorithm, and obtain a binary image representing the area where the text is located.
  • the image detection module 510 is specifically configured to call a contour detection function in a computer vision library to detect a binary image and obtain contour information.
  • the position determination module 520 is specifically configured to determine the position information of the initial bounding box by calling the minimum area rectangle function in the computer vision library according to the contour information.
  • the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
  • FIG. 6 shows a schematic block diagram of an example electronic device 600 that can be used to implement the text detection method of the embodiment of the present disclosure.
  • Electronic device is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers.
  • Electronic devices may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smart phones, wearable devices, and other similar computing devices.
  • the components shown herein, their connections and relationships, and their functions, are by way of example only, and are not intended to limit implementations of the disclosure described and/or claimed herein.
  • the device 600 includes a computing unit 601 that can execute according to a computer program stored in a read-only memory (ROM) 602 or loaded from a storage unit 608 into a random-access memory (RAM) 603. Various appropriate actions and treatments. In the RAM 603, various programs and data necessary for the operation of the device 600 can also be stored.
  • the computing unit 601, ROM 602, and RAM 603 are connected to each other through a bus 604.
  • An input/output (I/O) interface 605 is also connected to the bus 604 .
  • the I/O interface 605 includes: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a magnetic disk, an optical disk, etc. ; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, and the like.
  • the communication unit 609 allows the device 600 to exchange information/data with other devices over a computer network such as the Internet and/or various telecommunication networks.
  • the computing unit 601 may be various general-purpose and/or special-purpose processing components having processing and computing capabilities. Some examples of computing units 601 include, but are not limited to, central processing units (CPUs), graphics processing units (GPUs), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processing processor (DSP), and any suitable processor, controller, microcontroller, etc.
  • the calculation unit 601 executes various methods and processes described above, such as a character detection method.
  • the text detection method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 608 .
  • part or all of the computer program may be loaded and/or installed on the device 600 via the ROM 602 and/or the communication unit 609 .
  • the computer program When the computer program is loaded into RAM 603 and executed by computing unit 601, one or more steps of the text detection method described above can be performed.
  • the computing unit 601 may be configured to execute the text detection method in any other suitable manner (for example, by means of firmware).
  • Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips Implemented in a system of systems (SOC), complex programmable logic device (CPLD), computer hardware, firmware, software, and/or combinations thereof.
  • FPGAs field programmable gate arrays
  • ASICs application specific integrated circuits
  • ASSPs application specific standard products
  • SOC system of systems
  • CPLD complex programmable logic device
  • computer hardware firmware, software, and/or combinations thereof.
  • programmable processor can be special-purpose or general-purpose programmable processor, can receive data and instruction from storage system, at least one input device, and at least one output device, and transmit data and instruction to this storage system, this at least one input device, and this at least one output device an output device.
  • Program codes for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special purpose computer, or other programmable data processing devices, so that the program codes, when executed by the processor or controller, make the functions/functions specified in the flow diagrams and/or block diagrams Action is implemented.
  • the program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device.
  • a 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, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • the systems and techniques described herein can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user. ); and a keyboard and pointing device (eg, a mouse or a trackball) through which a user can provide input to the computer.
  • a display device e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor
  • a keyboard and pointing device eg, a mouse or a trackball
  • Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and can be in any form (including Acoustic input, speech input or, tactile input) to receive input from the user.
  • the systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., as a a user computer having a graphical user interface or web browser through which a user can interact with embodiments of the systems and techniques described herein), or including such backend components, middleware components, Or any combination of front-end components in a computing system.
  • the components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include: Local Area Network (LAN), Wide Area Network (WAN) and the Internet.
  • a computer system may include clients and servers.
  • Clients and servers are generally remote from each other and typically interact through a communication network.
  • the relationship of client and server arises by computer programs running on the respective computers and having a client-server relationship to each other.
  • the server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the problem of traditional physical host and VPS service ("Virtual Private Server", or "VPS" for short). ′′), there are defects such as high management difficulty and weak business scalability.
  • the server can also be a server of a distributed system, or a server combined with a blockchain.
  • steps may be reordered, added or deleted using the various forms of flow shown above.
  • each step described in the present disclosure may be executed in parallel, sequentially, or in a different order, as long as the desired result of the technical solution disclosed in the present disclosure can be achieved, no limitation is imposed herein.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Character Input (AREA)

Abstract

一种文字检测方法、装置、电子设备和存储介质,涉及人工智能领域,具体涉及深度学习领域、文字识别领域和图像处理领域。文字检测方法的具体实现方案为:检测表示待处理图像中文字所在区域的二值图像,得到文字所在区域的轮廓信息(S210);根据轮廓信息,确定针对文字的初始包围框的位置信息(S220);根据位置信息确定针对初始包围框的边延长值(S230);以及根据边延长值延长初始包围框的边,得到用于识别文字的包围框的位置信息(S240)。

Description

文字检测方法、装置、电子设备和存储介质
本申请要求于2022年02月07日递交的中国专利申请No.202210117039.6的优先权,其内容一并在此作为参考。
技术领域
本公开涉及人工智能技术领域,具体涉及深度学习领域、文字识别领域和图像处理领域。更具体地涉及一种文字检测方法、装置、电子设备和存储介质。
背景技术
随着计算机技术和网络技术的发展,深度学习技术在众多领域得到了广泛应用。例如,可以采用深度学习技术检测图像中的文字,定位得到图像中的文字区域,以便于对图像中的文字进行识别。
发明内容
本公开旨在提供一种提高检测效率的文字检测方法、装置、电子设备和存储介质。
根据本公开的一个方面,提供了一种文字检测方法,包括:检测表示待处理图像中文字所在区域的二值图像,得到文字所在区域的轮廓信息;根据轮廓信息,确定针对文字的初始包围框的位置信息;根据位置信息确定针对初始包围框的边延长值;以及根据边延长值延长初始包围框的边,得到用于识别文字的包围框的位置信息。
根据本公开的另一个方面,提供了一种文字检测装置,包括:图检测模块,用于检测表示待处理图像中文字所在区域的二值图像,得到文字所在区域的轮廓信息;位置确定模块,用于根据轮廓信息,确定针对文字的初始包围框的位置信息;值确定模块,用于根据位置信息确定针对初始包围框的边延长值;以及位置获得模块,用于根据边延长值延长初始包围框的边,得到用于识别文字的包围框的位置信息。
根据本公开的另一个方面,提供了一种电子设备,包括:至少一个处 理器;以及与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行本公开提供的文字检测方法。
根据本公开的另一个方面,提供了一种存储有计算机指令的非瞬时计算机可读存储介质,其中,计算机指令用于使计算机执行本公开提供的文字检测方法。
根据本公开的另一个方面,提供了一种计算机程序产品,包括计算机程序/指令,所述计算机程序/指令在被处理器执行时实现本公开提供的文字检测方法。
应当理解,本部分所描述的内容并非旨在标识本公开的实施例的关键或重要特征,也不用于限制本公开的范围。本公开的其它特征将通过以下的说明书而变得容易理解。
附图说明
附图用于更好地理解本方案,不构成对本公开的限定。其中:
图1是根据本公开实施例的文字检测方法和装置的应用场景示意图;
图2是根据本公开实施例的文字检测方法的流程示意图;
图3是根据本公开实施例的延长初始包围框的边的原理示意图;
图4是根据本公开实施例的文字检测方法的原理示意图;
图5是根据本公开实施例的文字检测装置的结构框图;以及
图6是用来实施本公开实施例的文字检测方法的电子设备的框图。
具体实施方式
以下结合附图对本公开的示范性实施例做出说明,其中包括本公开实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本公开的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。
本公开提供了一种文字检测方法,该方法包括图检测阶段、位置确定阶段、延长值确定阶段和位置获得阶段。在图检测阶段中,检测表示待处 理图像中文字所在区域的二值图像,得到文字所在区域的轮廓信息。在位置确定阶段中,根据轮廓信息,确定针对文字的初始包围框的位置信息。在延长值确定阶段中,根据位置信息确定针对初始包围框的边延长值。在位置获得阶段中,根据边延长值延长初始包围框的边,得到用于识别文字的包围框的位置信息。
以下将结合图1对本公开提供的方法和装置的应用场景进行描述。
图1是根据本公开实施例的文字检测方法和装置的应用场景示意图。
如图1所示,该实施例的应用场景100可以包括电子设备110,该电子设备110可以为具有处理功能的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机、台式计算机和服务器等等。
该电子设备110例如可以对输入的图像120进行文字检测,得到文字包围框130。通过对该文字包围框130内的图像进行文字识别,即可得到图像120中包括的文字。其中,电子设备110可以采用文字识别技术(例如光学字符识别技术OCR等)来对文字包围框130内的图像进行文字识别。通过先检测得到文字包围框130再进行文字识别,可以利于提高场景文字识别(Scene Text Recognition,STR)的精度。例如,可以实现对弯曲文字等的准确识别。
在一实施例中,该电子设备110可以借助文本检测算法140来进行文字检测,从而得到文字包围框130。其中,文本检测算法140可以为基于回归的检测算法或基于分割的检测算法。其中,基于回归的检测算法例如可以包括Textboxes算法、Textboxes++算法或旋转区域卷积神经网络(Rotational Region CNN,R2CNN)算法等。其中,基于分割的检测算法可以包括像素连接(Pixel-Link)算法、渐进式扩展网络(Progressive Scale Expansion Network,PSENet)、可微二值化网络(Differentiable Binarization Network,DBNet)等。
在一实施例中,该文本检测算法140可以由服务器150提供。例如,电子设备110可以通过网络与服务器150通信连接,以向服务器150发送算法获取请求。相应地,服务器150可以响应于该算法获取请求将文本检测算法140发送给电子设备110。在文本检测算法140通过深度学习网络模型实现时,服务器150例如还可以用于对该深度学习网络模型进行训练, 响应于算法获取请求发送训练好的深度学习网络模型。
在一实施例中,电子设备110还可以将输入的图像120发送给服务器150,由服务器150对该图像120进行文字检测,从而得到文字包围框,并对文字包围框中的文字进行识别。
需要说明的是,本公开提供的文字检测方法可以由电子设备110执行,也可以由服务器150执行。相应地,本公开提供的文字检测装置可以设置在电子设备110中,也可以设置在服务器150中。
应该理解,图1中的电子设备110和服务器150的数目和类型仅仅是示意性的。根据实现需要,可以具有任意数目和类型的电子设备110和服务器150。
以下将结合图1,通过以下图2~图4对本公开提供的文字检测方法进行详细描述。
图2是根据本公开实施例的文字检测方法的流程示意图。
如图2所示,该实施例的文字检测方法200包括操作S210~操作S240。
在操作S210,检测表示待处理图像中文字所在区域的二值图像,得到文字所在区域的轮廓信息。
根据本公开的实施例,待处理图像为包括文字的图像。例如,可以通过拍摄广告牌、商标、车、发票等具有文字的实体而得到待处理图像。
该实施例可以获取预先生成的二值图像来进行检测。或者,该实施例可以在获取待处理图像后,采用基于分割的文本检测算法来检测待处理图像,得到表示文字所在区域的二值图像。近似地,该二值图像中取值不为0的像素点为文字所在像素点,所有文字所在像素点构成的区域可以作为文字所在区域。其中,得到二值图像的原理详见下文描述,此处不再详述。
根据本公开的实施例,该实施例可以扫描二值图像中的每个像素点,确定与该每个像素点相邻的四个像素点的取值是否包括为0的像素点。若包括为0的像素点,则将该每个像素点作为轮廓点,否则确定该每个像素点为轮廓内的点或轮廓外的点。该实施例可以将连接该二值图像中的轮廓点所形成的目标区域,作为文字所在区域,并将连接形成该目标区域的轮廓点在二值图像中的坐标值作为文字所在区域的轮廓信息。其中,目标区域是指:区域内的像素点的取值均不为0的区域。
在操作S220,根据轮廓信息,确定针对文字的初始包围框的位置信息。
根据本公开的实施例,该实施例可以将前文描述的目标区域的最小外接矩形框作为针对文字的初始包围框。例如,该实施例可以确定连接形成目标区域的轮廓点中,在二值图的宽度方向上位于两端的两个轮廓点和在二值图的高度方向上位于两端的两个轮廓点。随后将确定的四个轮廓点作为四个目标轮廓点,将四个边分别经过该四个目标轮廓点的矩形框作为初始包围框。可以将该矩形框的四个顶点在二值图中的坐标值作为初始包围框的位置信息,也可以将四个轮廓点在二值图中的坐标值作为初始包围框的位置信息。
在操作S230,根据位置信息确定针对初始包围框的边延长值。
在操作S240,根据边延长值延长初始包围框的边,得到用于识别文字的包围框的位置信息。
根据本公开的实施例,在得到初始包围框的位置信息后,例如可以先根据该位置信息确定初始包围框的宽度和高度。随后可以将该宽度和高度的均方根作为边延长值。或者,可以将宽度与预定比例的乘积作为初始包围框宽度方向的边延长值,将高度与预定比例的乘积作为初始包围框高度方向的边延长值。其中,预定比例可以根据实际需求进行设定。
在得到边延长值后,即可延长初始包围框的边。例如,对于初始包围框的每个边,可以将该每个边的两个端点向相反方向延长相同的长度,得到延长后的边。在初始包围框的所有边均被延长后,可以得到多个延长后的边。该实施例可以连接多个延长后的边的所有端点,得到用于识别文字的包围框。即该用于识别文字的包围框的轮廓经过该多个延长后的边的所有端点。例如,该实施例可以将多个延长后的边的所有端点在二值图像中的坐标值作为该用于识别文字的包围框的位置信息。
本公开实施例通过根据初始包围框的位置信息来确定边延长值,并根据延长值延长初始包围框的边来得到用于识别文字的包围框的位置信息,可以使得确定的用于识别文字的包围框可以更好的覆盖待处理图像中的文字所在区域。这是因为,在检测待处理图像得到二值图像时,为了使得二值图像能够更好的体现出不同的文本行,往往会在一定程度上缩小文字 所在区域,则该二值图像表示的文字所在区域无法完整覆盖文字。相应地,检测二值图像得到的文字所在区域的轮廓信息和根据轮廓信息确定的初始包围框均存在无法完整体现文字区域的问题。
本公开实施例提供的文字检测方法,通过根据确定的边延长值来延长初始包围框的边,并基于延长后的边来得到文字的包围框,可以达到对包围框放大的目的及提高识别文字的包围框的精度的目的。相较于调用图形处理库(例如Clipper库等)来处理二值图像,并因此得到用于识别文字的包围框的技术方案,可以简化处理过程,减少计算量及资源占用量,并提高处理效率。如此,该实施例提供的文字检测方法的处理逻辑可以部署在终端设备等计算性能受限的设备上,利于提高文字检测方法的鲁棒性。
在一实施例中,可以调用轮廓检测函数来检测二值图像,从而得到文字所在区域的轮廓信息。其中,轮廓检测函数可以为计算机视觉库中的函数,计算机视觉库可以包括OpenCV等。例如,以计算机视觉库采用OpenCV为例,轮廓检测函数可以为findContours函数。其中,OpenCV是Inter开源计算机视觉库,由一系列C函数和少量C++类构成。可以理解的是,上述OpenCV仅作为示例以利于理解本公开,本公开可以采用任意的轻量级的计算机视觉库,本公开对此不做限定。
例如,该实施例可以将二值图像作为findContours函数中image参数的值,经由该findContours函数处理后,得到一个向量,该向量中包括至少一个点集合,每个点集合对应一个轮廓。可以理解的是,每个点集合中包括的点即为前文描述的轮廓点类似,在此不再赘述。
在一实施例中,可以调用最小外接矩形函数来确定针对文字的初始包围框的位置信息。其中,最小外接矩形函数可以为计算机视觉库中的函数。例如,以计算机视觉库采用OpenCV为例,最小外接矩形函数可以为minAreaRect函数。
例如,可以将前文描述的每个点集合作为minAreaRect函数的输入,由该minAreaRect函数处理后,输出矩形的四个顶点的坐标值。该矩形即为初始包围框,四个顶点的坐标值可以作为初始包围框的位置信息。采用该minAreaRect函数得到的矩形可以是由偏转角度的。即该矩形的各个边与二值图像的宽度方向之间的夹角及该各个边与二值图像的高度方向之 间的夹角均不为零。
该实施例通过调用计算机视觉库中的函数来得到文字所在区域的轮廓信息和初始包围框的位置信息,可以使得文字检测方法的处理逻辑能够采用C++代码等运行效率高的代码来实现。相较于因依赖Clipper库而采用python代码实现处理逻辑的技术方案,可以减少处理逻辑的部署时间,减少实现处理逻辑的代码对内容空间的占用,并提高文字检测效率。
图3是根据本公开实施例的得到用于识别文字的包围框的原理示意图。
根据本公开的实施例,在确定初始包围框的边延长值时,可以先根据初始包围框的位置信息来确定初始包围框的尺寸信息。然后根据尺寸信息和预定延长系数,来确定针对初始包围框的边延长值。该实施例通过设定延长系数,可以根据实际需求来灵活调整初始包围框的扩充幅度,便于使得得到的用于识别文字的包围框更为符合实际需求。
在一实施例中,确定的初始包围框的尺寸信息可以包括初始包围框的宽度和高度。该实施例可以将高度与预定延长系数的乘积作为初始包围框的高度方向的边的边延长值,将宽度与预定延长系数的乘积作为初始包围框的宽度方向的边的边延长值。其中,预定延长系数可以根据实际需求进行设定,本公开对此不做限定。
在一实施例中,确定的初始包围框的尺寸信息可以包括初始包围框的周长和面积。该实施例可以采用与Vatti Clipping算法的偏移系数D’的计算方法类似的方法,来根据周长和面积,确定边延长值。例如,可以先确定面积和周长的比值,将该比值与预定延长系数的乘积作为边延长值。该实施例通过根据确定的周长和面积来确定边延长值,可以使得本公开实施例的文字检测方法的原理更为贴合依赖Clipper库而实现的检测方法。如此,可以在提高处理效率的同时,使得得到的用于识别文字的包围框与经复杂处理过程而得到的包围框更为贴近,从而保证检测精度。
例如,设定初始包围框的位置信息由四个顶点在二值图像中的坐标值来表示,初始包围框的面积为A,初始包围框的周长为P,边延长值为d,则d例如可以采用以下公式计算得到:
d=A*unclip_ratio/D。
其中,D为周长P的
Figure PCTCN2022109024-appb-000001
倍,unclip_ratio可以为超参,用于调节包围 框扩充的幅度,该超参的取值例如可以为1.5等,本公开对此不做限定。
例如,初始包围框的面积A可以采用以下公式计算得到:
Figure PCTCN2022109024-appb-000002
其中,x 1、…、x n分别表示四个顶点中各个顶点在基于二值图像构建的坐标系中横轴的坐标值,y 1、…、y n分别表示四个顶点在基于二值图像构建的坐标系中纵轴的坐标值。其中,n的取值为4。
需要说明的是,确定的边延长值可以为边在一个方向上延长的值。该实施例可以对边在两个相反的方向上进行延长。
在一实施例中,如图3所示,在该实施例300中,设定初始包围框301的四个顶点分别为p_0、p_1、p_2、p_3,确定边延长值为d。在根据边延长值延长初始包围框的点时,可以先基于延长值延长初始包围框的边,得到延长后边的位置信息。随后,根据该延长后边的位置信息,确定用于识别文字的包围框的位置信息。
例如,对于初始包围框301中顶点p_0与顶点p_1连接形成的边,对该边沿两个相反的方向分别延长d,得到的延长后的边为点311与点312连接形成的边。类似地,对于初始包围框中顶点p_0与顶点p_3连接形成的边,对该边沿两个相反的方向分别延长d,得到的延长后的边为点313与点314连接形成的边。对于初始包围框中顶点p_1与顶点p_2连接形成的边、顶点p_2与顶点p_3连接形成的边,均通过类似的方式延长。通过延长初始包围框301的所有边,可以得到8个点。其中,可以由通过延长每个边得到的两个点的坐标值来表示与该每个边对应的延长后边的位置信息。例如,对于延长顶点p_0与顶点p_3连接形成的边所得到的延长后边,该延长后边的位置信息可以由点313的坐标值和点314的坐标值来表示。
例如,得到的8个点可以构成分别靠近顶点p_0、p_1、p_2、p_3的四个点组,每个点组包括两个点。例如,靠近顶点p_0的点组包括点311和点313。该实施例可以确定以该每个顶点及靠近该每个顶点的点组中的两个点作为三个顶点,确定一个矩形框。该实施例可以将该确定的矩形框中除该三个顶点外的另一个顶点作为用于识别文字的包围框的一个顶点。 如此,对于初始包围框301中的每个顶点,采用类似的方法均可以得到用于识别文字的包围框的一个顶点,总计得到用于识别文字的包围框的四个顶点,从而得到用于识别文字的包围框302。例如,该包围框302的位置信息可以由包围框302的四个顶点的坐标值来表示。
在一实施例中,在得到8个点后,可以将该8个点的坐标值构成点集,并将构成的点集作为前文描述的minAreaRect函数的输入,由该minAreaRect函数处理后,输出用于识别文字的包围框302的四个顶点的坐标值,从而得到用于识别文字的包围框的位置信息。
图4是根据本公开实施例的文字检测方法的原理示意图。
如图4所示,在该实施例400中,在进行文字检测时,可以先对待处理图像401进行检测,从而得到表示文字所在区域的二值图像。
例如,该实施例可以采用基于分割的(Segmentation-based)文本检测算法来对待处理图像401进行检测。以文本检测算法为DBNet 410为例,该实施例可以将待处理图像401输入DBNet 410,经过DBNet 410中的骨干网络(Backbone)来提取特征,得到特征图F。然后,DBNet 410可以根据该特征图F同时预测概率图(probability map)P 402和阈值图(threshold map)T 403。最后,该实施例可以将DBNet 410输出的预测概率图P 402作为二值图像B 404。
可以理解的是,在DBNet 410的训练过程中,二值图像需要根据预测概率P和阈值图T来计算二值图像B。例如,在训练过程中,对于二值图像B中第i行第j列的元素值B i,j,可以采用以下公式计算得到:
Figure PCTCN2022109024-appb-000003
其中,k是膨胀因子,该膨胀因子可以根据经验设定。P i,j为预测概率图P中第i行第j列的元素值,预测概率图P中的每个概率元素表示待处理图像中与该每个元素对应的像素点表示文本的概率。T i,j为阈值图T中第i行第j列的元素值,阈值图P中的每个元素表示针对待处理图像中与该每个元素对应的像素点的阈值。
在得到二值图像B 404后,可以对该二值图像B 404进行后处理,从而得到用于识别文字的包围框405的位置信息。其中,后处理可以通过前文图2中描述的操作S210~操作S240来实现,在此不再赘述。
该实施例通过采用基于分割的文本检测算法来检测待处理图像,可以使得该实施例的文字检测方法可以对自然场景下的弯曲文字及相邻文字进行精准检测。由于DBNet是采用动态阈值的方式来划分待处理图像中的文字所在区域和非文字所在区域的,因此采用DBNet来检测待处理图像,可以在一定程度上提高文字检测方法的检测精度及检测效率。DBNet之所以可以采用动态阈值的方式来划分文字所在区域和非文字所在区域,是因为DBNet为深度学习网络,DBNet通过不断的学习图像特征,可以不断的调整根据特征图F得到阈值图T时所涉及到的网络参数。
基于本公开提供的文字检测方法,本公开还提供了一种文字检测装置。以下将结合图5对该装置进行详细描述。
图5是根据本公开实施例的文字检测装置的结构框图。
如图5所示,该实施例的文字检测装置500可以包括图检测模块510、位置确定模块520、值确定模块530和位置获得模块540。
图检测模块510用于检测表示待处理图像中文字所在区域的二值图像,得到文字所在区域的轮廓信息。在一实施例中,图检测模块510可以用于执行前文描述的操作S210,在此不再赘述。
位置确定模块520用于根据轮廓信息,确定针对文字的初始包围框的位置信息。在一实施例中,位置确定模块520可以用于执行前文描述的操作S220,在此不再赘述。
值确定模块530用于根据位置信息确定针对初始包围框的边延长值。在一实施例中,值确定模块530可以用于执行前文描述的操作S230,在此不再赘述。
位置获得模块540用于根据边延长值延长初始包围框的边,得到用于识别文字的包围框的位置信息。在一实施例中,值确定模块530可以用于执行前文描述的操作S240,在此不再赘述。
根据本公开的实施例,上述值确定模块530可以包括尺寸确定子模块和延长值确定子模块。尺寸确定子模块用于根据位置信息确定初始包围框的尺寸信息。延长值确定子模块用于根据尺寸信息和预定延长系数,确定针对初始包围框的边延长值。
根据本公开的实施例,尺寸确定模块具体用于根据位置信息确定初始 包围框的周长和初始包围框的面积。
根据本公开的实施例,上述位置获得模块540可以包括边延长子模块和位置确定子模块。边延长子模块用于基于边延长值延长初始包围框的边,得到延长后边的位置信息。位置确定子模块用于根据延长后边的位置信息,确定针对文字的包围框的位置信息,作为用于识别文字的包围框的位置信息。
根据本公开的实施例,文字检测装置500还可以包括二值图获得模块,用于采用基于分割的文本检测算法检测待处理图像,得到表示文字所在区域的二值图像。
根据本公开的实施例,上述图检测模块510具体用于调用计算机视觉库中的轮廓检测函数检测二值图像,得到轮廓信息。上述位置确定模块520具体用于根据轮廓信息,调用计算机视觉库中的最小面积矩形函数确定初始包围框的位置信息。
需要说明的是,本公开的技术方案中,所涉及的用户个人信息的收集、存储、使用、加工、传输、提供、公开和应用等处理,均符合相关法律法规的规定,采取了必要保密措施,且不违背公序良俗。在本公开的技术方案中,在获取或采集用户个人信息之前,均获取了用户的授权或同意。
根据本公开的实施例,本公开还提供了一种电子设备、一种可读存储介质和一种计算机程序产品。
图6示出了可以用来实施本公开实施例的文字检测方法的示例电子设备600的示意性框图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本公开的实现。
如图6所示,设备600包括计算单元601,其可以根据存储在只读存储器(ROM)602中的计算机程序或者从存储单元608加载到随机访问存储器(RAM)603中的计算机程序,来执行各种适当的动作和处理。在 RAM 603中,还可存储设备600操作所需的各种程序和数据。计算单元601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。
设备600中的多个部件连接至I/O接口605,包括:输入单元606,例如键盘、鼠标等;输出单元607,例如各种类型的显示器、扬声器等;存储单元608,例如磁盘、光盘等;以及通信单元609,例如网卡、调制解调器、无线通信收发机等。通信单元609允许设备600通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。
计算单元601可以是各种具有处理和计算能力的通用和/或专用处理组件。计算单元601的一些示例包括但不限于中央处理单元(CPU)、图形处理单元(GPU)、各种专用的人工智能(AI)计算芯片、各种运行机器学习模型算法的计算单元、数字信号处理器(DSP)、以及任何适当的处理器、控制器、微控制器等。计算单元601执行上文所描述的各个方法和处理,例如文字检测方法。例如,在一些实施例中,文字检测方法可被实现为计算机软件程序,其被有形地包含于机器可读介质,例如存储单元608。在一些实施例中,计算机程序的部分或者全部可以经由ROM602和/或通信单元609而被载入和/或安装到设备600上。当计算机程序加载到RAM 603并由计算单元601执行时,可以执行上文描述的文字检测方法的一个或多个步骤。备选地,在其他实施例中,计算单元601可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行文字检测方法。
本文中以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、芯片上系统的系统(SOC)、复杂可编程逻辑设备(CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。
用于实施本公开的方法的程序代码可以采用一个或多个编程语言的任何组合来编写。这些程序代码可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器或控制器,使得程序代码当由处理器或控制器执行时使流程图和/或框图中所规定的功能/操作被实施。程序代码可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或服务器上执行。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。
可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质 的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)和互联网。
计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。其中,服务器可以是云服务器,又称为云计算服务器或云主机,是云计算服务体系中的一项主机产品,以解决了传统物理主机与VPS服务(″Virtual Private Server″,或简称″VPS″)中,存在的管理难度大,业务扩展性弱的缺陷。服务器也可以为分布式系统的服务器,或者是结合了区块链的服务器。
应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发公开中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本公开公开的技术方案所期望的结果,本文在此不进行限制。
上述具体实施方式,并不构成对本公开保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本公开的精神和原则之内所作的修改、等同替换和改进等,均应包含在本公开保护范围之内。

Claims (15)

  1. 一种文字检测方法,包括:
    检测表示待处理图像中文字所在区域的二值图像,得到所述文字所在区域的轮廓信息;
    根据所述轮廓信息,确定针对所述文字的初始包围框的位置信息;
    根据所述位置信息确定针对所述初始包围框的边延长值;以及
    根据所述边延长值延长所述初始包围框的边,得到用于识别所述文字的包围框的位置信息。
  2. 根据权利要求1所述的方法,其中,根据所述位置信息确定针对所述初始包围框的边延长值包括:
    根据所述位置信息确定所述初始包围框的尺寸信息;以及
    根据所述尺寸信息和预定延长系数,确定针对所述初始包围框的边延长值。
  3. 根据权利要求2所述的方法,其中,所述根据所述位置信息确定所述初始包围框的尺寸信息包括:
    根据所述位置信息确定所述初始包围框的周长和所述初始包围框的面积。
  4. 根据权利要求1所述的方法,其中,根据所述边延长值延长所述初始包围框的边,得到用于识别所述文字的包围框包括:
    基于所述边延长值延长所述初始包围框的边,得到延长后边的位置信息;以及
    根据所述延长后边的位置信息,确定用于识别所述文字的包围框的位置信息。
  5. 根据权利要求1所述的方法,还包括:
    采用基于分割的文本检测算法检测所述待处理图像,得到表示所述文字所在区域的二值图像。
  6. 根据权利要求1所述的方法,其中:
    所述检测表示所述待处理图像中文字所在区域的二值图像,得到所述 文字所在区域的轮廓信息包括:调用计算机视觉库中的轮廓检测函数检测所述二值图像,得到所述轮廓信息;
    所述根据所述轮廓信息,确定针对所述文字的初始包围框的位置信息包括:根据所述轮廓信息,调用所述计算机视觉库中的最小外接矩形函数确定所述初始包围框的位置信息。
  7. 一种文字检测装置,包括:
    图检测模块,用于检测表示待处理图像中文字所在区域的二值图像,得到所述文字所在区域的轮廓信息;
    位置确定模块,用于根据所述轮廓信息,确定针对所述文字的初始包围框的位置信息;
    值确定模块,用于根据所述位置信息确定针对所述初始包围框的边延长值;以及
    位置获得模块,用于根据所述边延长值延长所述初始包围框的边,得到用于识别所述文字的包围框的位置信息。
  8. 根据权利要求7所述的装置,其中,所述值确定模块包括:
    尺寸确定子模块,用于根据所述位置信息确定所述初始包围框的尺寸信息;以及
    延长值确定子模块,用于根据所述尺寸信息和预定延长系数,确定针对所述初始包围框的边延长值。
  9. 根据权利要求8所述的装置,其中,所述尺寸确定子模块用于:
    根据所述位置信息确定所述初始包围框的周长和所述初始包围框的面积。
  10. 根据权利要求7所述的装置,其中,所述位置获得模块包括:
    边延长子模块,用于基于所述边延长值延长所述初始包围框的边,得到延长后边的位置信息;以及
    位置确定子模块,用于根据所述延长后边的位置信息,确定用于识别所述文字的包围框的位置信息。
  11. 根据权利要求7所述的装置,还包括:
    二值图获得模块,用于采用基于分割的文本检测算法检测所述待处理 图像,得到表示所述文字所在区域的二值图像。
  12. 根据权利要求7所述的装置,其中:
    所述图检测模块用于:调用计算机视觉库中的轮廓检测函数检测所述二值图像,得到所述轮廓信息;
    所述位置确定模块用于:根据所述轮廓信息,调用所述计算机视觉库中的最小面积矩形函数确定所述初始包围框的位置信息。
  13. 一种电子设备,包括:
    至少一个处理器;以及
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1~6中任一项所述的方法。
  14. 一种存储有计算机指令的非瞬时计算机可读存储介质,其中,所述计算机指令用于使所述计算机执行根据权利要求1~6中任一项所述的方法。
  15. 一种计算机程序产品,包括计算机程序/指令,所述计算机程序/指令在被处理器执行时实现根据权利要求1~6中任一项所述方法的步骤。
PCT/CN2022/109024 2022-02-07 2022-07-29 文字检测方法、装置、电子设备和存储介质 WO2023147717A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210117039.6 2022-02-07
CN202210117039.6A CN114445825A (zh) 2022-02-07 2022-02-07 文字检测方法、装置、电子设备和存储介质

Publications (1)

Publication Number Publication Date
WO2023147717A1 true WO2023147717A1 (zh) 2023-08-10

Family

ID=81372235

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/109024 WO2023147717A1 (zh) 2022-02-07 2022-07-29 文字检测方法、装置、电子设备和存储介质

Country Status (2)

Country Link
CN (1) CN114445825A (zh)
WO (1) WO2023147717A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114445825A (zh) * 2022-02-07 2022-05-06 北京百度网讯科技有限公司 文字检测方法、装置、电子设备和存储介质
CN114842474B (zh) * 2022-05-09 2023-08-08 北京百度网讯科技有限公司 文字识别方法、装置、电子设备和介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113313111A (zh) * 2021-05-28 2021-08-27 北京百度网讯科技有限公司 文本识别方法、装置、设备和介质
CN113486828A (zh) * 2021-07-13 2021-10-08 杭州睿胜软件有限公司 图像处理方法、装置、设备和存储介质
CN113780098A (zh) * 2021-08-17 2021-12-10 北京百度网讯科技有限公司 文字识别方法、装置、电子设备以及存储介质
CN113780283A (zh) * 2021-09-17 2021-12-10 湖北天天数链技术有限公司 模型训练方法、文本检测方法、装置及轻量级网络模型
CN114445825A (zh) * 2022-02-07 2022-05-06 北京百度网讯科技有限公司 文字检测方法、装置、电子设备和存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105809164B (zh) * 2016-03-11 2019-05-14 北京旷视科技有限公司 文字识别方法和装置
CN110929755A (zh) * 2019-10-21 2020-03-27 北京海益同展信息科技有限公司 一种禽蛋检测方法、装置、系统、电子设备及存储介质
CN112308794A (zh) * 2020-10-27 2021-02-02 深圳Tcl数字技术有限公司 显示图像的校正方法、设备及计算机可读存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113313111A (zh) * 2021-05-28 2021-08-27 北京百度网讯科技有限公司 文本识别方法、装置、设备和介质
CN113486828A (zh) * 2021-07-13 2021-10-08 杭州睿胜软件有限公司 图像处理方法、装置、设备和存储介质
CN113780098A (zh) * 2021-08-17 2021-12-10 北京百度网讯科技有限公司 文字识别方法、装置、电子设备以及存储介质
CN113780283A (zh) * 2021-09-17 2021-12-10 湖北天天数链技术有限公司 模型训练方法、文本检测方法、装置及轻量级网络模型
CN114445825A (zh) * 2022-02-07 2022-05-06 北京百度网讯科技有限公司 文字检测方法、装置、电子设备和存储介质

Also Published As

Publication number Publication date
CN114445825A (zh) 2022-05-06

Similar Documents

Publication Publication Date Title
US20220147822A1 (en) Training method and apparatus for target detection model, device and storage medium
US20200320273A1 (en) Remote sensing image recognition method and apparatus, storage medium and electronic device
US11275961B2 (en) Character image processing method and apparatus, device, and storage medium
WO2023015941A1 (zh) 文本检测模型的训练方法和检测文本方法、装置和设备
WO2023147717A1 (zh) 文字检测方法、装置、电子设备和存储介质
EP3910543A2 (en) Method for training object detection model, object detection method and related apparatus
US11810319B2 (en) Image detection method, device, storage medium and computer program product
WO2024036847A1 (zh) 图像处理方法和装置、电子设备和存储介质
EP3876197A2 (en) Portrait extracting method and apparatus, electronic device and storage medium
CN114677565B (zh) 特征提取网络的训练方法和图像处理方法、装置
CN113205041B (zh) 结构化信息提取方法、装置、设备和存储介质
US20230196805A1 (en) Character detection method and apparatus , model training method and apparatus, device and storage medium
EP3846076A1 (en) Method, device, chip circuit and computer program product for recognizing mixed typeset texts
EP3910590A2 (en) Method and apparatus of processing image, electronic device, and storage medium
US20230260306A1 (en) Method and Apparatus for Recognizing Document Image, Storage Medium and Electronic Device
CN114429637B (zh) 一种文档分类方法、装置、设备及存储介质
WO2022257614A1 (zh) 物体检测模型的训练方法、图像检测方法及其装置
WO2022252675A1 (zh) 道路标注生成方法、装置、设备以及存储介质
WO2024040856A1 (zh) 一种缺陷检测方法、装置、电子设备及存储介质
JP2014535101A (ja) 画像中のテキストの検出を容易にする方法及び装置
CN113902899A (zh) 训练方法、目标检测方法、装置、电子设备以及存储介质
US20230096921A1 (en) Image recognition method and apparatus, electronic device and readable storage medium
CN113486881B (zh) 一种文本识别方法、装置、设备及介质
CN113887375A (zh) 一种文本识别方法、装置、设备及存储介质
CN114187435A (zh) 文本识别方法、装置、设备以及存储介质