Text detection method, terminal and computer-readable storage medium thereof

By extracting and correcting feature regions in card images using text detection methods, and using text detection models to detect bounding boxes and contour borders, the problem of poor accuracy in detecting slanted text lines is solved, the detection accuracy is improved, the false negative rate is reduced, and the robustness is enhanced.

CN113673497BActive Publication Date: 2024-11-05ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110827395.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-21
Publication Date
2024-11-05
Estimated Expiration
2041-07-21

AI Technical Summary

Technical Problem

Existing technologies have poor accuracy in detecting slanted text lines. Traditional OCR detection algorithms are not robust in natural scenes, especially in card images with complex backgrounds, slanted text lines, and text lines that are stuck together, where the detection effect is not ideal.

Method used

A text detection method is adopted, which involves acquiring the text image to be detected, extracting and correcting the feature region, using the trained text detection model to detect the bounding box and contour border of the feature map, and combining weighted fusion to determine the detection box, thereby improving the detection accuracy of slanted text lines and reducing the text false negative rate.

Benefits of technology

It improves the detection accuracy of slanted text lines, reduces the text false negative rate, enhances the robustness of text detection, and does not require edge shrinking of feature regions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113673497B_ABST
    Figure CN113673497B_ABST
Patent Text Reader

Abstract

The present invention provides a text detection method, a terminal and a computer-readable storage medium thereof. The text detection method obtains a text image to be detected, extracts features from a feature area and obtains a feature map; performs area detection on the feature map to obtain a boundary box of the feature map; performs text detection on the feature map to obtain an outline frame of the text in the feature map; determines a detection frame of the text to be detected based on the detected boundary box and the detected outline frame, thereby improving the detection accuracy of inclined text lines; and in the text detection method of the present application, it is not necessary to perform edge shrinking processing on the feature area, thereby greatly reducing the text missed detection rate, thereby improving the robustness of text detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and in particular to a text detection method, a terminal and a computer-readable storage medium thereof. Background Art

[0002] With the development of science and technology, it is becoming more and more common to automatically identify various bills and certificate information with the help of OCR (Optical Character Recognition) technology. For example, when handling business in a bank, it is necessary to identify the identity card information; during the law enforcement process of traffic police, it is necessary to identify the information of driver's licenses, vehicle registration certificates and other certificates.

[0003] At present, card images are mainly taken with mobile phones, and the content in the images is printed manually, which is prone to problems such as complex background, tilted text lines, and text line adhesion. Traditional OCR detection algorithms are not robust for card image detection in natural scenes. Summary of the invention

[0004] The main technical problem solved by the present invention is to provide a text detection method, a terminal and a computer-readable storage medium thereof, so as to solve the problem of poor detection accuracy of inclined text lines in the prior art.

[0005] To solve the above technical problems, the first technical solution adopted by the present invention is: to provide a text detection method, which includes: obtaining a text image to be detected, the text image to be detected at least includes a feature area of ​​the text to be detected; performing feature extraction on the feature area to obtain a feature map; performing region detection on the feature map to obtain a bounding box of the feature map; performing text detection on the feature map to obtain an outline frame of the text in the feature map; and determining a detection frame of the text to be detected based on the bounding box and the outline frame.

[0006] Among them, before the step of extracting features from the feature area to obtain the feature map, the step also includes: segmenting the image to be detected for text to obtain the feature area; and correcting the feature area so that the feature area is at a preset angle.

[0007] Among them, the step of determining the detection frame of the text to be detected based on the bounding box and the contour frame specifically includes: if it is determined that the distance between each corner point of the contour frame and the corresponding corner point of the bounding box is less than a first threshold, then the bounding box is used as the text detection frame.

[0008] Among them, based on the bounding box and the outline frame, the step of determining the detection frame of the text to be detected specifically includes: when the long side of the outline frame is in the horizontal direction, if it is determined that the difference between the two corner points of the short side of the outline frame in the horizontal direction is greater than a second threshold, then the bounding box is used as the text detection box; or when the long side of the outline frame is in the vertical direction, if it is determined that the difference between the two corner points of the short side of the outline frame in the vertical direction is greater than the second threshold, then the bounding box is used as the text detection box.

[0009] The step of determining the detection frame of the text to be detected based on the bounding box and the contour frame specifically includes: performing weighted fusion according to the bounding box and the contour frame to determine the detection frame of the text to be detected.

[0010] Among them, feature extraction is performed on the feature area to obtain a feature map, including: feature extraction is performed on the feature area based on a trained text detection model to obtain a feature map; wherein the text detection model is obtained by training an initial text detection model, and the initial text detection model includes a feature extraction unit, a text detection unit and a text correction unit.

[0011] Among them, the text detection model is obtained in the following manner: obtaining a training sample set, the training sample set includes multiple image samples containing text and text annotation boxes; segmenting a first feature area containing text in the image sample; extracting features from the first feature area by a feature extraction unit to obtain a first feature map; a text detection unit performs area detection on the first feature map to obtain a first prediction box; a text correction unit performs text detection on the first feature map to obtain a second prediction box; constructing a first loss function through the first prediction box and the text annotation box, and the second prediction box and the text annotation box; and using the first loss function to iteratively train the initial text detection model to obtain a text detection model.

[0012] Among them, the training sample set also includes the true category of the text; the method of obtaining the text detection model also includes: obtaining the predicted category of the text through the initial text detection model detection; constructing a second loss function according to the predicted category and the true category of the text; using the second loss function to iteratively train the initial text detection model to obtain the text detection model.

[0013] To solve the above technical problems, the second technical solution adopted by the present invention is: to provide a terminal, the mobile robot includes a memory, a processor and a computer program stored in the memory and running on the processor, and the processor is used to implement the steps in the above text detection method.

[0014] In order to solve the above technical problems, the third technical solution adopted by the present invention is: providing a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above text detection method are implemented.

[0015] The beneficial effects of the present invention are as follows: different from the prior art, a text detection method, a terminal and a computer-readable storage medium thereof are provided, which obtain a text image to be detected, perform feature extraction on a feature area and thereby obtain a feature map; perform area detection on the feature map to obtain a bounding box of the feature map; perform text detection on the feature map to obtain an outline frame of the text in the feature map; determine a detection frame of the text to be detected based on the detected bounding box and the detected outline frame, thereby improving the detection accuracy of inclined text lines; and in the text detection method of the present application, there is no need to perform edge shrinking processing on the feature area, thereby greatly reducing the text missed detection rate and thereby improving the robustness of text detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a flowchart of the text detection method provided by the present invention;

[0017] Figure 2 It is a flowchart of a specific embodiment of the text detection method provided by the present invention;

[0018] Figure 3 yes Figure 2 A flowchart of a specific embodiment of step S21 in the provided text detection method;

[0019] Figure 4 is a partial image of a driver's license in an embodiment of the present invention;

[0020] Figure 5 It is a schematic diagram of a framework of an embodiment of a text detection model provided by the present invention;

[0021] Figure 6 is a schematic block diagram of an implementation manner of a terminal provided by the present invention;

[0022] Figure 7 It is a schematic block diagram of an embodiment of a computer-readable storage medium provided by the present invention. DETAILED DESCRIPTION

[0023] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0024] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0025] In order to enable those skilled in the art to better understand the technical solution of the present invention, the text detection method provided by the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0026] See also Figure 1 , Figure 1 1 is a flow chart of the text detection method provided by the present invention. In this embodiment, a text detection method is provided, and the text detection method comprises the following steps.

[0027] S11: Obtain the text image to be detected.

[0028] Specifically, the text image to be detected can be an image captured by a camera of a terminal device, or can also be an image stored in the terminal device. The terminal device here can refer to a device such as a mobile phone, a tablet computer, or a vehicle-mounted device on a vehicle, which is not limited in the embodiments of the present invention.

[0029] The acquired text image to be detected can be any image that requires text detection, such as: images of natural scenes, images of direction signs, location signs, etc. in the scene where the blind are located when navigating; images of student homework; text detection of documents such as identity cards and driver's licenses, etc.

[0030] S12: Extract features from the feature area to obtain a feature map.

[0031] Specifically, the text detection model includes a segmentation correction unit, a feature extraction unit, a text detection unit and a text correction unit. The text image to be detected is input into the text detection model, and the segmentation correction unit recognizes the text detection image and segments it to obtain the feature area; then, the extracted feature area is corrected according to the aspect ratio of the feature area obtained by detection and recognition, so that the feature area is at a preset angle. The extracted feature area can also be corrected according to the distribution position of the items identified in the feature area, so that the feature area is at a preset angle. The purpose of segmenting and correcting the text image to be detected is to ensure that the interference of the background area on the text detection is reduced, and to ensure that the proportion of the text area relative to the entire image does not change.

[0032] After the feature area is adjusted to the preset angle, the feature extraction unit extracts features from the feature area to obtain a feature map corresponding to the feature area. In a specific embodiment, when the feature area is a card area, the feature extraction unit extracts features from the card area to obtain a card feature map.

[0033] S13: Perform region detection on the feature map to obtain a bounding box of the feature map.

[0034] Specifically, the feature map corresponding to the feature area is input to the text detection unit, and the text detection unit extracts features from the feature map and then performs region detection to obtain a bounding box of the text in the feature map. Specifically, the bounding box of the text in the feature map is a rectangular detection box.

[0035] S14: Perform text detection on the feature map to obtain the outline of the text in the feature map.

[0036] Specifically, the feature map corresponding to the feature area is input into the text correction unit, and the text correction unit extracts features from the feature map and then performs text detection, thereby obtaining the offsets of the four corners of the text in the feature map relative to the four corners of the bounding box, and then obtaining the outline of the text. The outline of the text in the feature map is a quadrilateral detection box.

[0037] S15: Determine a detection box of the text to be detected based on the bounding box and the contour frame.

[0038] Specifically, in an optional embodiment, it is determined whether the distances between the corner points of the outline frame and the corresponding corner points of the bounding box are all less than a first threshold. If the distances between the corner points of the outline frame and the corresponding corner points of the bounding box are all less than the first threshold, the bounding box is used as a text detection box. In another optional embodiment, when the long side of the outline frame is in the horizontal direction, it is determined whether the difference in the horizontal direction between the two corner points constituting the short side of the outline frame is greater than a second threshold. If the difference in the horizontal direction between the two corner points constituting the short side is greater than the second threshold, the bounding box is used as a text detection box. In another optional embodiment, when the long side of the outline frame is in the vertical direction, it is determined whether the difference in the vertical direction between the two corner points constituting the short side of the outline frame is greater than the second threshold. If the difference in the vertical direction between the two corner points constituting the short side is greater than the second threshold, the bounding box is used as a text detection box.

[0039] The text detection method provided in the present embodiment obtains a text image to be detected, uses a text detection model to extract features from a feature area and obtains a feature map; performs area detection on the feature map to obtain a bounding box of the feature map; performs text detection on the feature map to obtain an outline frame of the text in the feature map; determines a detection frame for the text to be detected by fusing the detected bounding box and the detected outline frame, thereby improving the detection accuracy of inclined text lines; and the text detection method of the present application does not require edge shrinking processing of the feature area, thereby greatly reducing the text missed detection rate and thereby improving the robustness of text detection.

[0040] See also Figure 2 , Figure 2 1 is a flow chart of a specific embodiment of a text detection method provided by the present invention. In this embodiment, a text detection method is provided, and the text detection method includes the following steps.

[0041] S21: Train the initial text detection model to obtain a text detection model.

[0042] Specifically, the initial text detection model is built based on the YOLOv3 network. Building the initial text detection model based on the YOLOv3 network can achieve multi-scale output, which can effectively reduce the missed detection rate of text in the text detection process. Among them, the initial text detection model includes a segmentation correction unit, a feature extraction unit, a text detection unit, and a text correction unit connected in sequence. Please refer to Figure 3 , Figure 3 yes Figure 2 The flowchart of step S21 in the text detection method provided is a specific embodiment. Specifically, the training of the initial text detection model includes the following steps.

[0043] S211: Obtain a training sample set, where the training sample set includes a plurality of image samples containing text, text annotation boxes, and true categories of the text.

[0044] Specifically, a plurality of image samples containing text are obtained, and the image samples containing text may be images taken by a camera of a terminal device. For example, the image sample containing text may be a picture containing a driver's license, a picture containing an ID card, or may include an image of a direction mark, a location mark, etc., taken in a scene where a blind person is located, an image of a student's homework, etc. The image sample containing text also includes a text annotation box for marking the text. In another optional embodiment, the text annotation box may be the coordinates of the minimum circumscribed rectangle of the text area in the image sample.

[0045] See also Figure 4 , Figure 4 is a partial image of a driver's license in an embodiment of the present invention. In another optional embodiment, the image sample containing text also includes the real category of the marked text. Among them, the real category of the text can be one of a key and a value. For example, the real category of the text "name" on the ID card is "key". The real category of "brand model", "address" and "registration date" on the driver's license is "key"; the real category of the text "Zhang ×" on the ID card is "value", and the real category of "××××× transport", "×× province" and "2007-××-××" on the driver's license is "value". By marking the category of the text, the adhered text can be effectively distinguished.

[0046] In another optional embodiment, image samples containing text may be subjected to rotation enhancement, affine enhancement, and illumination enhancement processing and then added to the training sample set to expand the amount of data in the training sample set, thereby improving the robustness of the trained text detection model.

[0047] In another optional embodiment, it is also necessary to mark the angle of the text in the image sample, wherein the angle of the text is the angle between the text and the horizontal axis.

[0048] S212: Segment the first feature region containing text in the image sample.

[0049] Specifically, the above-mentioned image sample containing text is input into the initial text detection model, the segmentation correction unit identifies the position of the first feature area containing text in the image sample containing text, separates the first feature area containing text from the background area, and the segmentation correction unit segments and extracts the first feature area containing text; then the extracted first feature area is corrected according to the aspect ratio of the text obtained by detection and recognition, so that the first feature area is at a preset angle. The extracted first feature area can also be corrected according to the position of the items identified in the first feature area, so that the first feature area is at a preset angle. Specifically, the angle of the first feature area is determined according to the positional relationship between the "key" and "value" identified in the first feature area, the positional relationship between the "key" and "value" and the pre-stored template The position of the "key" and "value" and the difference between the position of the "key" and "value" determine the angle of the first feature area, and adjust it to the preset angle according to the angle of the first feature area.

[0050] In a specific embodiment, the first feature region is rotated to a preset angle. For example, the preset angle may be 0°, 90°, 180° or 270° with respect to the horizontal axis, thereby facilitating subsequent feature extraction of the first feature region and improving the accuracy of text detection in the first feature region.

[0051] In another optional embodiment, the first feature region may be rotated and adjusted according to the angle of the annotated text, so that the angle between the first feature region and the horizontal axis is 0°, 90°, 180° or 270°, thereby facilitating subsequent feature extraction of the first feature region, thereby improving the accuracy of text detection in the first feature region.

[0052] S213: Extract features from the first feature area to obtain a first feature map.

[0053] Specifically, after the first feature area is adjusted to a preset angle, the feature extraction unit extracts features from the first feature area to obtain a first feature map corresponding to the first feature area. In a specific embodiment, when the first feature area is a card area, the feature extraction unit extracts features from the card area to obtain a card feature map.

[0054] S214: performing region detection on the first feature map to obtain a first prediction box; performing text detection on the first feature map to obtain a second prediction box.

[0055] Specifically, the first feature map corresponding to the first feature region is input to the text detection unit, and the text detection unit extracts features from the first feature map and then performs region detection to obtain a first prediction box of the text in the first feature map. Specifically, the first prediction box of the text in the first feature map is a rectangular detection box.

[0056] Specifically, the first feature map corresponding to the first feature area is input to the text correction unit, and the text correction unit performs feature extraction on the first feature map and then performs text detection, thereby obtaining the offsets of the four corners of the text in the first feature map relative to the four corners of the first prediction box, and then obtaining the second prediction box of the text. The second prediction box of the text in the first feature map is a quadrilateral detection box.

[0057] S215: Construct a first loss function through the first prediction box and the text annotation box, and the second prediction box and the text annotation box.

[0058] Specifically, a regression loss function is used to calculate the error values ​​between the first prediction box and the text annotation box, and between the second prediction box and the text annotation box. In a specific embodiment, the first loss function is a regression loss function shown in the following formula (1).

[0059] L=a0×exp(-kt)×L1+(1-a0×exp(-kt))×L2 (1)

[0060] Where: L1 is the regression loss value of the rectangular detection box, L2 is the loss function of the final quadrilateral detection box, the initial value of a0 is 1, t is the number of iterations, k is a hyperparameter, and the coefficient of L1 is 1 and the coefficient of L2 is 0 in the initial case of the function.

[0061] Among them, with the increase of training generations, the L1 front coefficient gradually decays and the L2 coefficient gradually increases, that is, the rectangular detection frame coefficient gradually decreases and the quadrilateral detection frame coefficient gradually increases.

[0062] S216: Using the first loss function to iteratively train the initial text detection model to obtain a text detection model.

[0063] Specifically, the initial text detection model is iteratively trained through the error values ​​between the first prediction box and the text annotation box, and between the second prediction box and the text annotation box to obtain the text detection model.

[0064] In an optional embodiment, the result of the initial text detection model is back-propagated, and the weight of the initial text detection model is modified according to the loss value fed back by the first loss function. In an optional embodiment, the parameters in the initial text detection model can also be modified to achieve the training of the initial text detection model.

[0065] The image sample containing text is input into the initial text detection model, and the initial text detection model predicts the text. When the error value between the first prediction box and the text annotation box, and the error value between the second prediction box and the text annotation box is less than a preset threshold value, which can be set by itself, such as 1%, 5%, etc., the training of the initial text detection model is stopped and the text detection model is obtained.

[0066] S217: Recognize the text detected in the first feature map to obtain a predicted category of the text.

[0067] Specifically, an image sample containing text is input into an initial text detection model, and the initial text detection model predicts the text category in the image sample to obtain a predicted category of the text.

[0068] S218: Construct a second loss function according to the predicted category and the true category of the text.

[0069] Specifically, a cross-entropy loss function is used to calculate the error value between the predicted category and the true category. In a specific embodiment, the second loss function is a cross-entropy loss.

[0070] S219: Iteratively train the text detection model using the second loss function.

[0071] Specifically, the text detection model is iteratively trained by the error value between the predicted category and the true category.

[0072] In an optional embodiment, the result of the text detection model is back-propagated, and the weight of the text detection model is modified according to the loss value fed back by the second loss function. In an optional embodiment, the parameters in the text detection model can also be modified to achieve training of the text detection model.

[0073] When the error value between the predicted category and the true category of the text is less than a preset threshold, which can be set by yourself, such as 1%, 5%, etc., the training of the text detection model is stopped.

[0074] S22: Obtain the text image to be detected.

[0075] Specifically, the text image to be detected can be an image captured by a camera of a terminal device, or can also be an image stored in the terminal device. The terminal device here can refer to a device such as a mobile phone, a tablet computer, or a vehicle-mounted device on a vehicle, which is not limited in the embodiments of the present invention.

[0076] The acquired text image to be detected can be any image that requires text detection, such as: images of natural scenes, images of direction signs, location signs, etc. in the scene where the blind are located when navigating; images of student homework; text detection of documents such as identity cards and driver's licenses, etc.

[0077] S23: Segment the image to be detected for text to obtain feature regions.

[0078] Specifically, the text image to be detected is input into the text detection model, the segmentation correction unit identifies the location of the feature area in the text image to be detected, separates the feature area and the background area in the text to be detected, and the segmentation correction unit segments and extracts the feature area in the text image to be detected.

[0079] S24: Correcting the feature area so that the feature area is at a preset angle.

[0080] Specifically, the extracted feature area is corrected according to the aspect ratio of the feature area obtained by detection and identification, so that the feature area is at a preset angle. The extracted feature area can also be corrected according to the positions of the items identified in the feature area, so that the feature area is at a preset angle. In a specific embodiment, the feature area is rotated to a preset angle. For example, the preset angle can be 0°, 90°, 180° or 270° with the horizontal axis, thereby facilitating subsequent feature extraction of the feature area and improving the accuracy of text detection in the feature area. The purpose of segmenting and correcting the text image to be detected is to ensure that the interference of the background area on the text detection is reduced, and to ensure that the proportion of the text area relative to the entire image does not change.

[0081] S25: Extract features from the feature area through the text detection model to obtain a feature map.

[0082] See also Figure 5 , Figure 5 1 is a schematic diagram of a framework of an embodiment of a text detection model provided by the present invention. Specifically, after the feature area is adjusted to a preset angle, the feature extraction unit extracts features from the feature area and obtains a feature map corresponding to the feature area. In a specific embodiment, when the feature area is a card area, the feature extraction unit extracts features from the card area to obtain a card feature map.

[0083] S26: Perform region detection on the feature map to obtain a bounding box of the feature map.

[0084] Specifically, the feature map corresponding to the feature area is input to the text detection unit, and the text detection unit extracts features from the feature map and then performs region detection to obtain a bounding box of the text in the feature map. Specifically, the bounding box of the text in the feature map is a rectangular bounding box.

[0085] S27: Perform text detection on the feature map to obtain the outline of the text in the feature map.

[0086] Specifically, the feature map corresponding to the feature area is input into the text correction unit, and the text correction unit extracts features from the feature map and then performs text detection, thereby obtaining the offsets of the four corners of the text in the feature map relative to the four corners of the bounding box, and then obtaining the quadrilateral outline frame of the text. The outline frame of the text in the feature map is a quadrilateral detection frame.

[0087] S28: Perform weighted fusion based on the bounding box and the contour frame to determine the detection box of the text to be detected.

[0088] Specifically, in an optional embodiment, it is determined whether the distances between the corner points of the outline frame and the corresponding corner points of the bounding box are all less than a first threshold. If the distances between the corner points of the outline frame and the corresponding corner points of the bounding box are all less than the first threshold, the bounding box is used as a text detection box. In another optional embodiment, when the long side of the outline frame is in the horizontal direction, it is determined whether the difference in the horizontal direction between the two corner points constituting the short side of the outline frame is greater than a second threshold. If the difference in the horizontal direction between the two corner points constituting the short side is greater than the second threshold, the bounding box is used as a text detection box. In another optional embodiment, when the long side of the outline frame is in the vertical direction, it is determined whether the difference in the vertical direction between the two corner points constituting the short side of the outline frame is greater than the second threshold. If the difference in the vertical direction between the two corner points constituting the short side is greater than the second threshold, the bounding box is used as a text detection box.

[0089] The text detection method provided in the present embodiment obtains a text image to be detected, uses a text detection model to extract features from a feature area and obtains a feature map; performs area detection on the feature map to obtain a bounding box of the feature map; performs text detection on the feature map to obtain an outline frame of the text in the feature map; determines a detection frame for the text to be detected by fusing the detected bounding box and the detected outline frame, thereby improving the detection accuracy of inclined text lines; and the text detection method of the present application does not require edge shrinking processing of the feature area, thereby greatly reducing the text missed detection rate and thereby improving the robustness of text detection.

[0090] See also Figure 6 , Figure 6 1 is a schematic block diagram of an embodiment of a terminal provided by the present invention. Figure 6 As shown, the terminal 70 in this embodiment includes: a processor 71, a memory 72, and a computer program stored in the memory 72 and executable on the processor 71. When the computer program is executed by the processor 71, the above-mentioned text detection method is implemented. To avoid repetition, they are not described one by one here.

[0091] See also Figure 7 , Figure 7 It is a schematic block diagram of an embodiment of a computer-readable storage medium provided by the present invention.

[0092] A computer-readable storage medium 90 is also provided in an embodiment of the present application. The computer-readable storage medium 90 stores a computer program 901. The computer program 901 includes program instructions. The processor executes the program instructions to implement any text detection method provided in the embodiment of the present application.

[0093] The computer-readable storage medium 90 may be an internal storage unit of the computer device of the aforementioned embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium 90 may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device.

[0094] The above are only implementation modes of the present invention, and are not intended to limit the patent protection scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A text detection method, It is characterized in that The text detection method comprises: Acquire a text image to be detected, wherein the text image to be detected at least includes a feature area of ​​the text to be detected; Performing feature extraction on the feature area to obtain a feature map; Performing region detection on the feature map to obtain a bounding box of the feature map; Performing text detection on the feature map to obtain a contour frame of the text in the feature map; Based on the bounding box and the outline frame, determining the detection frame of the text to be detected; wherein the step of determining the detection frame of the text to be detected based on the bounding box and the outline frame specifically includes: If it is determined that the distances between the corner points of the outline frame and the corresponding corner points of the bounding box are all less than a first threshold, the bounding box is used as the text detection box; Wherein, when the long side of the outline frame is in the horizontal direction, if it is determined that the difference between the two corner points constituting the short side of the outline frame in the horizontal direction is greater than a second threshold, the boundary box is used as the text detection box; Or when the long side of the outline frame is in the vertical direction, if it is determined that the difference between the two corner points constituting the short side of the outline frame in the vertical direction is greater than a second threshold, the boundary box is used as the text detection box.

2. The text detection method according to claim 1, It is characterized in that Before the step of extracting features from the feature area to obtain a feature map, the step further includes: Segmenting the to-be-detected text image to obtain the feature region; The characteristic region is corrected to obtain a characteristic region at a preset angle.

3. The text detection method according to claim 1, It is characterized in that The step of determining the detection frame of the text to be detected based on the boundary box and the outline frame specifically includes: A detection frame of the text to be detected is determined by performing weighted fusion on the boundary box and the contour frame.

4. The text detection method according to claim 2, It is characterized in that The step of extracting features from the feature area to obtain a feature map includes: The feature area is subjected to feature extraction based on the trained text detection model to obtain the feature map; wherein the text detection model is obtained by training an initial text detection model, and the initial text detection model includes a feature extraction unit, a text detection unit and a text correction unit.

5. The text detection method according to claim 4, It is characterized in that The text detection model is obtained in the following way: Acquire a training sample set, wherein the training sample set includes a plurality of image samples containing text and text annotation boxes; Segmenting a first feature region containing the text in the image sample; Extracting features from the first feature area by the feature extraction unit to obtain a first feature map; The text detection unit performs region detection on the first feature map to obtain a first prediction frame; the text correction unit performs text detection on the first feature map to obtain a second prediction frame; Constructing a first loss function through the first prediction box and the text annotation box, and the second prediction box and the text annotation box; The initial text detection model is iteratively trained using the first loss function to obtain the text detection model.

6. The text detection method according to claim 5, It is characterized in that The training sample set also includes the true category of the text; The method of obtaining the text detection model also includes: Obtaining a predicted category of the text by detecting with the initial text detection model; Constructing a second loss function according to the predicted category of the text and the true category; The initial text detection model is iteratively trained using the second loss function to obtain the text detection model.

7. A terminal, It is characterized in that The terminal includes a memory, a processor, and a computer program stored in the memory and running on the processor, and the processor is used to execute the program data to implement the steps in the text detection method according to any one of claims 1 to 6.

8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the text detection method according to any one of claims 1 to 6 are implemented.