Character detection method and system for fuzzy fonts and terminal equipment

Through multi-scale feature fusion and weighted gradient image processing, the problem of fuzzy font recognition in the existing technology is solved, and the accuracy and robustness of text detection are improved, especially in the case of the coexistence of multiple blurs and curved fonts.

CN118747896APending Publication Date: 2024-10-08GUANGDONG SOUTHCN COM INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410768422.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-14
Publication Date
2024-10-08

AI Technical Summary

Technical Problem

When dealing with blurred fonts, it is difficult for the existing technology to effectively identify multiple blur types and curved fonts, resulting in low detection accuracy. Especially when multiple blurs coexist or blur-non-blur images are mixed, the text detection performance is poor.

Method used

Using a method based on multi-scale feature fusion, the blur degree is estimated by calculating the edge gradient value of the text candidate area, generating a weighted gradient image, classifying text areas and non-text areas, and performing secondary filtering to remove non-text areas to form a more accurate Text component.

Benefits of technology

It improves the accuracy and robustness of text detection, can effectively identify multiple blur types and curved fonts, reduces the impact of background aliasing, and improves detection performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118747896A_ABST
    Figure CN118747896A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of character recognition, and provides a character detection method for fuzzy fonts, which comprises the following steps: obtaining a text candidate region in a text image based on multi-scale feature fusion; estimating the fuzzy degree of the text candidate region by calculating the edge gradient value of the text candidate region; calculating to obtain a gradient image of the text candidate region, and obtaining a weight gradient image based on the fuzzy degree and the gradient image; classifying image pixel points of the weight gradient image, and dividing the text candidate region into a text region and a non-text region; performing secondary filtering on the text region, and removing a non-text region in the text region to form a text component; and grouping the text components to form the text components. According to the text detection method and device, the problems of relatively low text detection performance and relatively low detection accuracy in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of text recognition, and in particular, relates to a text detection method, system and terminal device for fuzzy fonts. Background Art

[0002] Text recognition is a technology that uses computers to automatically recognize characters. To recognize text on a page, it is usually necessary to detect the text on the page. However, the text on the page usually contains a variety of complex scenes, and font blur is a common one in practical applications. It is also one of the key factors affecting detection and recognition results.

[0003] In the prior art, machine learning and deep learning methods are usually used to solve the problem of font blur that occurs during text recognition. Generally speaking, methods for improving the text detection performance of blurred images can be classified into the following two categories: (1) deblurring the text before detecting it; (2) classifying the blurred image and the non-blurred image before processing it.

[0004] In the above two methods, method (1) usually processes specific blur types and uses different deblurring strategies to reduce the impact of blur effects on text recognition, while method (2) sorts blurry images from non-blurred images for further processing. In summary, the success rate of text detection in the above two methods depends largely on the deblurring effect or the accuracy of blur type classification. Moreover, these methods do not consider the challenges brought by the coexistence of multiple blurs. For example, when the same local text image area is affected by multiple blur types at the same time or when blurry and non-blurred images are mixed, the text detection performance of the above two methods is low. In addition, if the font in the blurred image is also curved in any direction, the complexity of the problem in the text detection process will increase, resulting in a low detection accuracy rate for curved fonts in the above two methods. Summary of the invention

[0005] The embodiments of the present application provide a text detection method, system and terminal device for fuzzy fonts to solve at least one of the above-mentioned problems in the prior art.

[0006] In a first aspect, an embodiment of the present application provides a method for detecting text in fuzzy fonts, comprising:

[0007] Based on multi-scale feature fusion, the text candidate region in the text image is obtained;

[0008] By calculating the edge gradient value of the text candidate area, the blur degree of the text candidate area is estimated;

[0009] Calculate and obtain a gradient image of the text candidate area, and obtain a weighted gradient image based on the blur degree and the gradient image;

[0010] Classifying the image pixels of the weighted gradient image, and dividing the text candidate area into a text area and a non-text area;

[0011] Performing secondary filtering on the text area to remove non-text areas in the text area to form a text component;

[0012] The text components are grouped to form text components, wherein the text components are text components belonging to the same text line.

[0013] In a second aspect, an embodiment of the present application provides a text detection system for fuzzy fonts, including: a text region candidate module: used to obtain a text candidate region in a text image based on multi-scale feature fusion;

[0014] Blur degree calculation module: used to calculate the edge gradient value of the text candidate area and estimate the blur degree of the text candidate area;

[0015] Weighted gradient image module: used to calculate the gradient image of the text candidate area, and obtain the weighted gradient image based on the blur degree and the gradient image;

[0016] A text candidate region division module: used for classifying the image pixels of the weighted gradient image and dividing the text candidate region into a text region and a non-text region;

[0017] Secondary filtering module: used for performing secondary filtering on the text area, removing the non-text area in the text area to form a text component;

[0018] Text component grouping module: groups the text components to form text components, wherein the text components are text components belonging to the same text line.

[0019] In a third aspect, an embodiment of the present application provides a terminal device, comprising: a memory and a processor and a computer program stored in the memory, and when the computer program is executed on the processor, the text detection method for fuzzy fonts as described in the above method is implemented.

[0020] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0021] (1) A text region generation model based on multi-scale feature fusion is designed to obtain text candidate regions. At the same time, in this model, in order to solve the problem of fusion of features of different scales, a fusion method is proposed to first sum up multiple basic feature maps and then concatenate them to form a new feature, so as to obtain a more compact and accurate text candidate region.

[0022] (2) By designing a method of combining the blur degree of the text candidate area with the gradient image, the present application can detect the text area from the text candidate areas containing multiple blur types without the need for deblurring preprocessing.

[0023] (3) By performing secondary filtering on the text area, false text in the text area is filtered out, solving the detection problems of curved fonts and background aliased fonts in the scene. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0025] Figure 1 It is a flowchart of a text detection method for fuzzy fonts provided by an embodiment of the present invention;

[0026] Figure 2 It is a structural schematic diagram of a text candidate region generation model of a text detection method for fuzzy fonts provided by an embodiment of the present invention;

[0027] Figure 3 It is a structural schematic diagram of a discriminant classifier of a text detection method for fuzzy fonts provided by an embodiment of the present invention;

[0028] Figure 4 It is a structural schematic diagram of a text detection system for fuzzy fonts provided by an embodiment of the present invention;

[0029] Figure 5 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0031] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0032] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0033] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0034] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0035] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0036] See also Figure 1 As shown, the present invention is a text detection method for fuzzy fonts, comprising the following steps:

[0037] S100, obtaining a text candidate region in the text image based on multi-scale feature fusion;

[0038] In some embodiments, the above step S100 includes:

[0039] Input the text image into the trained text candidate region generation model to obtain the text candidate region;

[0040] Wherein, the text candidate region generation model includes a feature extraction module, a feature fusion module and a multi-task output module;

[0041] The feature extraction module is used to extract basic features of the text image to obtain at least one basic feature map;

[0042] The feature fusion module is used to fuse the basic feature maps to obtain a feature fusion image;

[0043] The multi-task output module includes multiple parallel first convolutional layers, inputs the feature fusion image into the multiple first convolutional layers, and simultaneously executes the corresponding tasks in each first convolutional layer to obtain the text candidate area, wherein the corresponding tasks in the first convolutional layer include text position loss calculation, scale judgment loss calculation and boundary regression loss calculation.

[0044] like Figure 2 As shown, the text candidate region generation model in this embodiment includes a feature extraction module, a feature fusion module and a multi-task output module, wherein the feature extraction module adopts the design of VGG-16, and constructs a feature extraction network by directly stacking 3×3 third convolutional layers. After each downsampling, the number of kernels is increased by 1.5-2 times. In addition, since the robust scene text characteristics can also be obtained by random initialization and fewer network parameters, the network appropriately reduces the number of kernels. The third convolutional layer of the first layer adopts VGG-16 with 64 kernels, that is, the convolution kernel of the third convolutional layer of the first layer is 3×3×64; in addition, the convolution kernels of the third convolutional layers of different layers in VGG-16 use different sizes, which is helpful for extracting multi-scale features. When the multi-scale features are fused by the feature fusion module, the basic features can be enhanced, thereby making the basic features more discriminative. Preferably, in this embodiment, the convolution kernel of the third convolutional layer of the second layer is 3×3×128, and the convolution kernel of the third convolutional layer of the third layer is 3×3×256.

[0045] At the same time, in order to expand the receptive field, an additional 3×3 fourth convolutional layer is inserted or attached, thereby increasing the size of the input image that the receptive field of the feature extraction network can cover. Preferably, in this embodiment, the convolution kernel of the fourth convolutional layer is 3×3×512. The multi-task output module includes multiple parallel first convolutional layers, such as Figure 2 As shown, in this embodiment, the number of first convolutional layers is three, and each first convolutional layer is provided with corresponding tasks, namely, text position loss calculation, scale judgment loss calculation and boundary regression loss calculation. When the feature fusion image is input into the multi-task output module, the tasks in the first convolutional layer can be executed simultaneously, so as to obtain the position and scale of the text candidate area at the same time.

[0046] In addition, the text candidate area generation model also includes a backbone network. The backbone network of this embodiment adopts the Res50-Dilated model. The Res50-Dilated model has the advantage of not reducing the image resolution when extracting basic features, thereby ensuring that the resolution of each output basic feature map is the same, effectively retaining the feature details of the text image, improving the accuracy of feature extraction, and greatly reducing the number of convolutional layers, reducing the amount of calculation, thereby effectively improving the training speed.

[0047] In some embodiments, the feature fusion module includes multiple layers of second convolutional layers, and the feature fusion module is used to fuse the basic feature maps to obtain a feature fusion image, including:

[0048] Inputting the plurality of basic feature maps into different second convolutional layers of the feature fusion module in sequence, and the second convolutional layer outputs corresponding feature tensors;

[0049] Summing the feature tensors of different second convolutional layers to obtain a fused feature tensor;

[0050] Dimensionally concatenating the plurality of fused feature tensors to obtain new features;

[0051] Based on the new features, the feature fusion module is enabled to output the feature fusion image.

[0052] In this embodiment, since the text recognition scene has a variety of text objects, including both very small texts and relatively large texts, multiple basic feature maps can be obtained when the feature extraction module outputs. If only simple underlying features are used, the diversity of feature representation cannot be improved. Therefore, the feature fusion module in this embodiment uses a fusion method in which the multiple basic feature maps output by the feature extraction module are first summed and then spliced. Specifically, the basic features output by different third convolutional layers are first summed to make the output of feature information between two adjacent third convolutional layers smoother. At the same time, each third convolutional layer can learn the differences in basic features from different basic feature maps. Finally, the summation results of different third convolutional layers are spliced ​​into new features, which not only improves the convergence speed of the text candidate area generation model, but also greatly improves the performance of the text candidate area generation model, thereby obtaining a more compact and accurate text candidate area.

[0053] Specifically, in one embodiment of the present invention, Figure 2 As shown, the three third convolutional layers of the feature extraction module are set to C 1 , C 2 and C 3 , the three fourth convolutional layers are C 4 , C 5 and C6 , the three second convolutional layers are C 7 , C 8 and C 9 , C 3 The basic feature map input C of the layer output 7 In the layer, C 4 The basic feature map input C of the layer output 8 In the layer, C 5 The basic feature map input C of the layer output 9 In the layer, set the C 8 , C 9 The two feature tensors output by the layer are f (8) and f (9) , where f (8) , C 8 Layer and C 9 The layers are summed to obtain the fused feature tensor, and the result is:

[0054]

[0055] In formula (1), 1≤i≤H, 1≤j≤W, 1≤l≤D; where i, j, l are the indices of the feature tensor on each dimension, H is the height, W is the width, and D is the depth.

[0056] C 7 The feature tensor output by the layer is f (7) , C 7 The output of the layer after the pooling layer is f′ (7) , f (7) and The dimensions in are summed in the same way as in formula (1) to obtain the fused feature tensor

[0057] Finally, the fused feature tensors are concatenated into new features by concatenating the following dimensions:

[0058]

[0059] Since the proposed model does not use C 6 After the last pooling layer, C 3 The size of the feature map is then C 4 and C 5 To sum them, a maximum pooling with a 2×2 kernel and a 2×2 stride is applied, so that in (2),

[0060] S200, estimating the blur degree of the text candidate region by calculating the edge gradient value of the text candidate region;

[0061] In this embodiment, in order to estimate the blur degree of the grayscale image I of a text candidate area, a horizontal low-pass filter g is used. H and vertical low-pass filter g V , perform convolution operation on the text candidate region.

[0062] In some embodiments, the step S200 includes:

[0063] Preprocess the text candidate area to obtain a grayscale image I;

[0064] The grayscale image I is convolved by a horizontal low-pass filter and a vertical low-pass filter to obtain an output image I of the horizontal low-pass filter. H and the vertical low-pass filter output image I V ;

[0065] Among them, I V =g V *I,I H =g H *I, T stands for matrix transpose.

[0066] Based on the output image I V , the absolute difference value D of the grayscale image I in the horizontal direction V (x, y) inputs the horizontal low-pass filter and outputs the absolute difference image Among them, x and y are the horizontal and vertical coordinates of the grayscale image I, D V (x,y)=|I(x,y)-I(x-1,y)|,

[0067] Based on the output image I H , the absolute difference value D of the grayscale image I in the vertical direction H (x, y) inputs the vertical low-pass filter and outputs the absolute difference image Among them, D H (x,y)=|I(x,y)-I(x,y-1)|,

[0068] Based on the D V (x,y) and Obtain the difference value DV(x,y) of the absolute difference image in the vertical direction, where:

[0069] Based on the D H (x,y) and Obtain the difference value DH(x,y) of the absolute difference image in the horizontal direction, where

[0070] Calculate the difference value D V (x,y),D H The sum of the coefficients of (x,y), DV(x,y), and DH(x,y) S DV and S DH ,in: X and Y are the length and width of the grayscale image respectively;

[0071] Based on the S DV , S DH , S DV and S DH , calculate the blur degree φ of the text candidate area,

[0072] in, φ V and φ H Respectively represent the degree of blur in the vertical and horizontal directions.

[0073] S300, calculating and obtaining a gradient image of the text candidate area, and obtaining a weighted gradient image based on the blur degree and the gradient image;

[0074] Specifically, the gradient image is generally used to extract the edge information of the image. For the text part, the gradient value will be relatively high in both the blurred and non-blurred images. For the text pixel area in the non-blurred image, the gradient value is often high and the blur degree is low, while for the text pixel area in the blurred image, the gradient value will be slightly lower and the blur degree is higher. Therefore, in the present invention, in order to make it unnecessary to pre-judge the blur type before text detection for images with different blur types, and to have a better text detection effect, the blur degree is combined with the gradient image, that is, the blur degree and the gradient image are weighted to obtain a weighted gradient image, wherein a high weighted gradient image value represents a text pixel, and a low weighted gradient image value represents a non-text pixel, and the text candidate area can be divided into a text area and a non-text area.

[0075] In some embodiments, the step S300 includes:

[0076] Perform noise reduction on the grayscale image to obtain a smooth image;

[0077] Obtaining the gradient magnitude and direction of the smoothed image by calculation;

[0078] Performing non-maximum suppression on the gradient amplitude of the smoothed image to obtain an initial edge image;

[0079] The initial edge image is detected by a double threshold algorithm to determine the final gradient image P;

[0080] Based on the blur degree, the gradient image is weighted to obtain a weighted gradient image P w , where P W =φ*P.

[0081] In this embodiment, the Canny algorithm is used to calculate the gradient image, which can accurately detect the edge in the image and has good resistance to noise.

[0082] Specifically, a two-dimensional Gaussian filter with a window size of b×b is set to perform a smoothing filter operation on the grayscale image I to obtain a smoothed image. The Gaussian function calculation formula is:

[0083]

[0084] Among them, σ is the standard deviation of the Gaussian function, the pixel at the center of the window is used as the coordinate origin, x and y represent the horizontal and vertical pixel coordinates respectively, and the pixel values ​​in the filter window are obtained through K;

[0085] The Sobel operator is an edge detection operator of the first-order derivative. The Sobel operator is used to calculate the gradient amplitude and direction of the smoothed image, and then the maximum value of each pixel is retained by non-maximum suppression. Specifically, since the gradient value of each pixel is positive or negative, the gradient value of each pixel is compared. If the amplitude of the gradient of the current pixel is greater than the gradient amplitude of the two adjacent pixels in the positive and negative directions of the gradient, the point is considered to be an edge point and its corresponding position is marked as 1. Otherwise, the point is suppressed as a non-edge point and its corresponding position is marked as 0 to obtain the initial edge map. image; a double threshold algorithm is used to determine the final gradient image. Specifically, a low threshold and a high threshold of edge detection are set. The pixels with a gradient amplitude lower than the low threshold are non-edge pixels, the pixels with a gradient amplitude between the low threshold and the high threshold are weak edge pixels, and the pixels with a gradient amplitude higher than the high threshold are strong edge pixels. The non-edge pixels in the initial edge image are removed, the weak edge pixels in the initial edge image are suppressed, and the strong edge pixels in the initial edge image are connected in sequence to obtain the final gradient image P. Then, the gradient image and the blur degree are weighted to obtain the weighted gradient image P. W .

[0086] S400, classifying the image pixels of the weighted gradient image, and dividing the text candidate region into a text region and a non-text region;

[0087] In this embodiment, the text candidate regions are preliminarily classified based on the weighted gradient image values, and then the K-means classification method is used to divide the text candidate regions into text regions and non-text regions.

[0088] In some embodiments, the above step S400 includes:

[0089] Select two points in the image pixels as aggregation centers;

[0090] The distance between each image pixel and the two aggregation centers is calculated respectively, and the category of each image pixel is determined to form two pixel categories;

[0091] Calculate the mean distance between each image pixel and the aggregation center in the two pixel categories respectively;

[0092] Compare the means of the two pixel categories and determine that the pixel category with a higher mean is the text area, and the pixel category with a lower mean is the non-text area.

[0093] In this embodiment, based on the weighted gradient image value, the image pixels of the weighted gradient image are preliminarily divided into a text pixel set and a non-text pixel set, and then a point in the text pixel set and the non-text pixel set are respectively selected as the aggregation center, and the distance between each image pixel and the two aggregation centers is calculated, and each image pixel is further divided into two pixel categories. Then, in each pixel category, the distance between the image pixel in the pixel category and the aggregation center of the pixel category is calculated, and the mean of the distance is calculated. By comparing the mean values ​​of the two pixel categories, the final text area and the non-text area are determined. Specifically, the mean value of the text area is higher, and the mean value of the non-text area is lower.

[0094] S500, performing secondary filtering on the text area to remove non-text areas in the text area to form a text component;

[0095] When the image background is complex or has high blur, the text may overlap with the background to a certain extent, thereby interfering with the detection result. Therefore, in this embodiment, the text area is filtered twice to reduce the noise effect caused by factors such as the background in the text area, thereby improving the accuracy of text detection.

[0096] In some embodiments, the step S500 includes:

[0097] Dividing each of the text regions into a plurality of equal sub-regions according to the length and width of each of the text regions;

[0098] The Bhattacharyya distance is used to calculate the similarity between the histograms of the pixels in each sub-region;

[0099] Based on the similarity, obtain the similarity set M of the sub-region corresponding to the lth text region l and the total similarity set of L text regions

[0100] The total similarity set As a training set, the elements in the total similarity set are used as feature vectors to train the discriminative classifier;

[0101] The non-text area in the text area is filtered out twice by the discriminant classifier to verify the output text component.

[0102] In this embodiment, since there is usually symmetry between the sub-regions containing text in the text region, and the pixel values ​​of the text in the text region are relatively close, the text region is divided into multiple sub-regions, and the similarity of the pixel values ​​in each sub-region is calculated. Based on the similarity, the sub-regions are grouped into a total similarity set. At the same time, in order to take into account both classification performance and training efficiency, a discriminant classifier is introduced in this embodiment, and the total similarity set is used as a training set, and then the non-text area in the text region is secondary filtered out through the trained discriminant classifier.

[0103] Specifically, based on the length and width of the text region, the lth text region is divided into four equal sub-regions, and the Bhattacharyya distance is used to calculate the similarity m of the histograms of the pixels in the four sub-regions respectively. The similarity between the i-th sub-region and the j-th sub-region in the lth text region is:

[0104]

[0105] In formula (3), is the mean value of the pixel value distribution in sub-region i, It can be obtained by the following formula:

[0106]

[0107] In formula (4), N is the total number of pixels in the sub-region, and Qc is the statistical number of pixels of a certain gray level c in the sub-region.

[0108] Based on formula (3) and formula (4), the sub-region similarity set corresponding to the lth text region is obtained: Then the total similarity set of L text regions is,

[0109] like Figure 3 As shown, in this embodiment, an extreme learning machine is used as a discriminant classifier, the total similarity set is used as a training set, and the elements of the total similarity set are used as feature vectors, then the training set is Set training set labels where z ρ ∈{-1,1}, -1 is the non-text category, 1 is the text category.

[0110] In the extreme learning machine, the number of hidden layer nodes is set to J, and the weight vector of each hidden node τ is randomly preset and the bias value b τ ;

[0111] According to the training set And the preset hidden layer parameters Find the hidden layer output matrix

[0112] Based on the hidden layer output matrix R and label vector Calculate the weight vector of the output layer As shown below:

[0113]

[0114] In formula (5), is a pseudo-inverse matrix, then As shown below:

[0115]

[0116] In formula (6), λ is the regularization coefficient, E is the inverse identity matrix, and RT is the transposed matrix of R.

[0117] Solving the output layer weights, the output layer solution is equivalent to the minimum value of the sum of the norm of the error vector between the hidden layer output matrix and the training set label and the norm of the regularization term. The calculation formula is as follows:

[0118]

[0119] In formula (7), ‖·‖ represents the norm operation.

[0120] Another total similarity set M is used as a validation set to input the discriminant classifier after training for verification, and the output expression of the input set M and the output of each hidden layer node in the discriminant classifier is obtained:

[0121]

[0122] In formula (8), o(M) is Represents the relationship function between the intermediate hidden layer and the input set M.

[0123] Through the above-mentioned discriminant classifier, the text area can be filtered twice, thereby filtering out the non-text area in the text area and obtaining the text component.

[0124] S600. Grouping the text components to form text components, wherein the text components are text components belonging to the same text line.

[0125] Since the obtained text components may contain one or more text symbols, such as a single character, a whole word or a part of a word, and these text symbols can be in any direction or horizontal angle, and there may even be curved texts, such as stamps or labels, etc., therefore, in this embodiment, the text components are further grouped to obtain more accurate text components.

[0126] In some embodiments, the step S600 includes:

[0127] dividing the text component into a plurality of candidate text components;

[0128] Calculating the Euclidean distance between the center points of the bounding boxes of two candidate text components;

[0129] Determining the nearest neighbor text components between the plurality of candidate text components according to the Euclidean distance;

[0130] The sizes and directions of the nearest neighbor text components are verified, and the nearest neighbor text components of the same size and the same direction are grouped into text components belonging to the same text line.

[0131] Since the distance between two text symbols in a normal text component is much smaller than the distance between two words, two lines or two sentences, in this embodiment, the text component is divided into multiple candidate text components, and the Euclidean distance between the center points of the bounding boxes of two candidate text components is calculated respectively, and the nearest neighbor text components between the multiple candidate text components are determined. By the size and direction between the neighbor text components, each neighbor text component can be divided into text components of the same text line. For curved text, the bounding box of the candidate text component is the curved text line, and the bounding box of the curved text is determined by combining the curvature information of the bounding box of each candidate text component.

[0132] See also Figure 4 The present invention also provides a text detection system for fuzzy fonts, the system comprising:

[0133] Text region candidate module: used to obtain text candidate regions in text images based on multi-scale feature fusion;

[0134] Blur degree calculation module: used to calculate the edge gradient value of the text candidate area and estimate the blur degree of the text candidate area;

[0135] Weighted gradient image module: used to calculate the gradient image of the text candidate area, and obtain the weighted gradient image based on the blur degree and the gradient image;

[0136] A text candidate region division module: used for classifying the image pixels of the weighted gradient image and dividing the text candidate region into a text region and a non-text region;

[0137] Secondary filtering module: used for performing secondary filtering on the text area, removing the non-text area in the text area to form a text component;

[0138] Text component grouping module: groups the text components to form text components, wherein the text components are text components belonging to the same text line.

[0139] It is understandable that if Figure 1 The contents of the embodiment of the text detection method for fuzzy fonts shown in the figure are all applicable to the embodiment of the text detection system for fuzzy fonts. The functions specifically implemented by the embodiment of the text detection system for fuzzy fonts are similar to those of the embodiment of the text detection method for fuzzy fonts shown in the figure. Figure 1 The text detection method for fuzzy fonts shown in the embodiment is the same as that in the embodiment shown in the embodiment, and the beneficial effects achieved are the same as those in the embodiment shown in the embodiment. Figure 1 The beneficial effects achieved by the embodiment of the text detection method for fuzzy fonts shown are also the same.

[0140] See also Figure 5 The embodiment of the present invention further provides a terminal device 5, comprising: a memory 502 and a processor 501 and a computer program 503 stored in the memory 502. When the computer program 503 is executed on the processor 501, the text detection method for fuzzy fonts as described in any one of the above methods is implemented.

[0141] The terminal device 5 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device 5 may include, but is not limited to, a processor 501 and a memory 502. Those skilled in the art will appreciate that Figure 5 It is only an example of the terminal device 5 and does not constitute a limitation on the terminal device 5. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.

[0142] The processor 501 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0143] In some embodiments, the memory 502 may be an internal storage unit of the terminal device 5, such as a hard disk or memory of the terminal device 5. In other embodiments, the memory 502 may also be an external storage device of the terminal device 5, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 5. Further, the memory 502 may also include both an internal storage unit and an external storage device of the terminal device 5. The memory 502 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 502 may also be used to temporarily store data that has been output or is to be output.

[0144] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for detecting text in fuzzy fonts, characterized in that: include: Based on multi-scale feature fusion, the text candidate region in the text image is obtained; By calculating the edge gradient value of the text candidate area, the blur degree of the text candidate area is estimated; Calculate and obtain a gradient image of the text candidate area, and obtain a weighted gradient image based on the blur degree and the gradient image; Classifying the image pixels of the weighted gradient image, and dividing the text candidate area into a text area and a non-text area; Performing secondary filtering on the text area to remove non-text areas in the text area to form a text component; The text components are grouped to form text components, wherein the text components are text components belonging to the same text line.

2. The method according to claim 1, characterized in that The method of obtaining a text candidate region in a text image based on multi-scale feature fusion includes: Input the text image into the trained text candidate region generation model to obtain the text candidate region; Wherein, the text candidate region generation model includes a feature extraction module, a feature fusion module and a multi-task output module; The feature extraction module is used to extract basic features of the text image to obtain at least one basic feature map; The feature fusion module is used to fuse the basic feature maps to obtain a feature fusion image; The multi-task output module includes multiple parallel first convolutional layers, inputs the feature fusion image into the multiple first convolutional layers, and simultaneously executes the corresponding tasks in each first convolutional layer to obtain the text candidate area, wherein the corresponding tasks in the first convolutional layer include text position loss calculation, scale judgment loss calculation and boundary regression loss calculation.

3. The method according to claim 2, characterized in that The feature fusion module includes multiple layers of second convolutional layers, and the feature fusion module is used to fuse the basic feature maps to obtain a feature fusion image, including: Inputting the plurality of basic feature maps into different second convolutional layers of the feature fusion module in sequence, and the second convolutional layer outputs corresponding feature tensors; Summing the feature tensors of different second convolutional layers to obtain a fused feature tensor; Dimensionally concatenating the plurality of fused feature tensors to obtain new features; Based on the new features, the feature fusion module is enabled to output the feature fusion image.

4. The method according to claim 1, characterized in that The step of calculating the edge gradient value of the text candidate region and estimating the blur degree of the text candidate region includes: Preprocess the text candidate area to obtain a grayscale image I; The grayscale image I is convolved by a horizontal low-pass filter and a vertical low-pass filter to obtain an output image I of the horizontal low-pass filter. H and the vertical low-pass filter output image I V ; Based on the output image I V , the absolute difference value D of the grayscale image I in the horizontal direction V (x, y) inputs the horizontal low-pass filter and outputs the absolute difference image Among them, x and y are the horizontal and vertical coordinates of the grayscale image I, D V (x,y)=|I(x,y)-I(x-1,y)|, Based on the output image I H , the absolute difference value D of the grayscale image I in the vertical direction H (x, y) inputs the vertical low-pass filter and outputs the absolute difference image Among them, D H (x,y)=|I(x,y)-I(x,y-1)|, Based on the D V (x,y) and Obtain the difference value DV(x,y) of the absolute difference image in the vertical direction, where: Based on the D H (x,y) and Obtain the difference value DH(x,y) of the absolute difference image in the horizontal direction, where Calculate the difference value D V (x,y),D H The sum of the coefficients of (x,y), DV(x,y), and DH(x,y) S DV and S DH ,in: X and Y are the length and width of the grayscale image respectively; Based on the S DV and S DH , calculate the blur degree φ of the text candidate area, in, φ V and φ H Respectively represent the degree of blur in the vertical and horizontal directions.

5. The method according to claim 4, characterized in that The step of calculating the gradient image of the text candidate area and obtaining a weighted gradient image based on the blur degree and the gradient image includes: Perform noise reduction on the grayscale image to obtain a smooth image; Obtaining the gradient magnitude and direction of the smoothed image by calculation; Performing non-maximum suppression on the gradient amplitude of the smoothed image to obtain an initial edge image; The initial edge image is detected by a double threshold algorithm to determine the final gradient image P; Based on the blur degree, the gradient image is weighted to obtain a weighted gradient image P w , where P W =φ*P.

6. The method according to claim 1, characterized in that The classifying the image pixels of the weighted gradient image to divide the text candidate area into a text area and a non-text area includes: Select two points in the image pixels as aggregation centers; The distance between each image pixel and the two aggregation centers is calculated respectively, and the category of each image pixel is determined to form two pixel categories; Calculate the mean distance between each image pixel and the aggregation center in the two pixel categories respectively; Compare the means of the two pixel categories and determine that the pixel category with a higher mean is the text area, and the pixel category with a lower mean is the non-text area.

7. The method according to claim 1, characterized in that The secondary filtering of the text area to remove the non-text area in the text area to form a text component includes: Dividing each of the text regions into a plurality of equal sub-regions according to the length and width of each of the text regions; The Bhattacharyya distance is used to calculate the similarity between the histograms of the pixels in each sub-region; Based on the similarity, obtain the similarity set M of the sub-region corresponding to the lth text region l and the total similarity set of L text regions The total similarity set As a training set, the elements in the total similarity set are used as feature vectors to train the discriminative classifier; The non-text area in the text area is filtered out twice by the discriminant classifier to verify the output text component.

8. The method according to claim 1, characterized in that The grouping of the text components to form text components, wherein the text components are text components belonging to the same text line, includes: dividing the text component into a plurality of candidate text components; Calculating the Euclidean distance between the center points of the bounding boxes of two candidate text components; Determining the nearest neighbor text components between the plurality of candidate text components according to the Euclidean distance; The sizes and directions of the nearest neighbor text components are verified, and the nearest neighbor text components of the same size and the same direction are grouped into text components belonging to the same text line.

9. A text detection system for fuzzy fonts, characterized in that: include: Text region candidate module: used to obtain text candidate regions in text images based on multi-scale feature fusion; Blur degree calculation module: used to calculate the edge gradient value of the text candidate area and estimate the blur degree of the text candidate area; Weighted gradient image module: used to calculate the gradient image of the text candidate area, and obtain the weighted gradient image based on the blur degree and the gradient image; A text candidate region division module: used for classifying the image pixels of the weighted gradient image and dividing the text candidate region into a text region and a non-text region; Secondary filtering module: used for performing secondary filtering on the text area, removing the non-text area in the text area to form a text component; Text component grouping module: groups the text components to form text components, wherein the text components are text components belonging to the same text line.

10. A terminal device, comprising: A memory, a processor and a computer program stored in the memory, when the computer program is executed on the processor, implements the text detection method for fuzzy fonts as claimed in any one of claims 1 to 8.