Image scene text detection method based on adaptive feature fusion

Through the combination of ResNet and feature pyramid network, combined with the adaptive feature fusion of feature aliasing and channel attention module, the text detection difficulties in multi-scale and complex backgrounds in the prior art are solved, and the accuracy of scene text detection is improved and performance.

CN118887648AActive Publication Date: 2024-11-01BEIJING UNIV OF POSTS & TELECOMM
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410899366.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-11-01
Estimated Expiration
2044-07-05

AI Technical Summary

Technical Problem

Existing scene text detection methods are difficult to effectively deal with multi-scale, multi-language, and rich-shaped texts, and lack of detection capabilities in complex backgrounds, and insufficient feature extraction and fusion lead to false detection and missed detection problems.

Method used

Multi-scale feature extraction is used for ResNet backbone network, feature fusion is combined with feature pyramid network and feature aliasing module, adaptive feature fusion is performed through channel attention module, and differentiable binarization post-processing is performed to obtain scene text detection results.

Benefits of technology

It improves the accuracy of multi-attribute text detection and text detection performance in complex contexts, reduces false detection and missed detection, and enhances the model's ability to express multi-scale features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118887648A_ABST
    Figure CN118887648A_ABST
Patent Text Reader

Abstract

The invention provides an image scene text detection method based on adaptive feature fusion. The method comprises the following steps: performing multi-scale feature (x2, x3, x4 and x5) extraction on a scene text image to be processed by using a ResNet backbone network, performing preliminary multi-scale feature fusion on the multi-scale features (x2, x3, x4 and x5) by using a feature pyramid network, outputting fused multi-scale features (o2, o3, o4 and o5), and inputting the fused multi-scale features into a feature aliasing module to obtain multi-scale features (p2, p3, p4 and p5); splicing the multi-scale features (p2, p3, p4, p5) to obtain a multi-scale feature matrix P; performing adaptive feature fusion on the multi-scale feature matrix P by using a channel attention module to obtain a fused multi-scale feature Q; and performing micro-binarization post-processing on the Q to obtain a probability graph and a threshold graph, and obtaining a scene text detection result in the scene text image to be processed according to the probability graph and the threshold graph. According to the method, feature aliasing is carried out on the multi-scale features from the channel dimension to the space dimension, the expression ability of the features of different scales is effectively improved, and the performance of a text detection algorithm is improved.
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 text detection, and in particular to an image scene text detection method based on adaptive feature fusion. Background Art

[0002] Scene text refers to text content that exists in various natural scenarios and can reflect information about a specific environment or entity, such as billboards, product labels, road signs, printed clothing, banners, etc. Scene text detection (STD) technology and scene text recognition (STR) technology are extensions of optical character recognition (OCR) technology in natural scene images. Scene text detection and recognition technology first uses text detection technology to obtain the location information of the text in the image, and then crops out part of the image containing the text content, and then uses text recognition technology to obtain the text information in the cropped image. Scene text detection and recognition technology has broad application prospects, such as bank bills, self-service parking payment and other work operations, behavior recognition, intelligent question and answer, and scene understanding and other research tasks.

[0003] Current OCR technology can already efficiently process clearly printed regular text content. However, scene text detection usually faces challenges from various aspects, which mainly come from:

[0004] (1) Scene text has multi-attribute characteristics. In natural scene images, the attributes of text are usually complex and diverse: (1) The scale of text in the same image varies greatly, and it has multi-scale characteristics; (2) The text is in a variety of languages, such as Chinese, English, and Japanese, and it has multi-lingual characteristics; (3) The arrangement direction and shape of text are rich, such as curved text, artistic font text, etc.

[0005] (2) Image background and interference factors are complex. (1) Unlike the clear and neat background in paper documents or printed texts, the background information of natural scene texts is more complex. Texts are easily affected by factors such as image brightness changes, background texture interference, and occlusion interference; (2) During the shooting process, it is easy to obtain low-quality images with occlusion, blur, and deformation due to camera shake, lighting, and shooting angle.

[0006] At present, scene text detection methods in the prior art are mainly divided into two categories: regression-based (top-down) methods and segmentation-based (bottom-up) methods.

[0007] Regression-based text detection methods are mainly based on target detection technology and instance segmentation technology, such as Faster R-CNN (Region-based Convolutional Neural Network) and SSD (Single Shot MultiBox Detector). This method regards text as a general target to be detected and directly generates horizontal or multi-directional text instance bounding boxes of arbitrary shapes. Early methods of this type generally adopted the idea of ​​sliding windows, introduced CNN (Convolutional Neural Network) to extract image features, and then classified the sliding window and the pixels it enclosed into text and non-text.

[0008] The disadvantages of the above regression-based text detection methods include: it is difficult for regression-based methods to obtain the precise boundaries of the bounding box, especially for multi-scale text with large length, width and length-to-width ratio spans. In addition, since text may appear densely and the text edges are not as prominent as general objects, it is easy to make it difficult to accurately distinguish the boundaries of adjacent text instances, resulting in the problem of difficulty in distinguishing different text instances.

[0009] The segmentation-based text detection method defines text detection as a semantic segmentation problem. It uses CNN to perform binary classification detection on the image at the pixel or text segment level, and then aggregates the pixels or text segments into complete text instances in the post-processing stage to obtain the text bounding box. First, the different text regions are segmented, and the center region of the text is first scaled, and then gradually expanded from the center region to cover the complete text region.

[0010] Segmentation-based methods rely on feature extraction from the backbone network for post-processing operations. The differentiable binarization model proposed by DBNet introduces the threshold map into the network for training, effectively reducing the computational complexity of post-processing. However, due to the insignificance of text features, the feature extraction and fusion of multi-scale text directly affects the performance of the detection model. How to perform efficient multi-scale feature extraction and feature fusion while maintaining low model complexity is the focus of current researchers.

[0011] The shortcomings of the above segmentation-based text detection method include: insufficient feature extraction. The channel reduction operation in the feature extraction stage loses the channel dimension information, and the upsampling operation introduces redundant spatial dimension information, which reduces the ability of this technical solution to detect multi-attribute text. Insufficient feature fusion. The inability to fully fuse the extracted multi-scale features reduces the ability of this technical solution to detect text in complex backgrounds. Summary of the invention

[0012] The invention provides an image scene text detection method based on adaptive feature fusion to realize effective scene text detection on images.

[0013] In order to achieve the above object, the present invention adopts the following technical scheme.

[0014] An image scene text detection method based on adaptive feature fusion, comprising:

[0015] Use the ResNet backbone network to extract multi-scale features from the scene text image to be processed. The ResNet backbone network outputs 4 initial multi-scale features (x2, x3, x4, x5);

[0016] Use the feature pyramid network to perform preliminary multi-scale feature fusion on the four initial multi-scale features (x2, x3, x4, x5), and the feature pyramid network outputs four fused multi-scale features (o2, o3, o4, o5);

[0017] The four fused multi-scale features (o2, o3, o4, o5) are input into a feature mixing module with four-way mixing factors (1, 2, 4, 8) respectively. The feature mixing module mixes the four fused multi-scale features (o2, o3, o4, o5) from the channel dimension to the spatial dimension, and outputs four multi-scale features (p2, p3, p4, p5) containing rich spatial information.

[0018] Use CONCAT to concatenate four multi-scale features (p2, p3, p4, p5) containing rich spatial information; obtain the multi-scale feature matrix P;

[0019] Use the channel attention module to perform adaptive feature fusion on the multi-scale feature matrix P to obtain the fused multi-scale feature Q;

[0020] The fused multi-scale feature Q is post-processed by differentiable binarization to obtain a probability map and a threshold map, and the scene text detection result in the scene text image to be processed is obtained according to the probability map and the threshold map.

[0021] Preferably, the ResNet backbone network is used to extract multi-scale features from the RGB image to be processed, and the ResNet backbone network outputs 4 initial multi-scale features (x2, x3, x4, x5), including:

[0022] ResNet18 is used as the feature extraction backbone network to process the RGB image of size (H, W, 3) The input is fed into the feature extraction backbone network, which consists of five convolution stages. Convolution stage 1 performs preliminary feature extraction on the input image. The subsequent convolution stages 2 to 4 extract features of the image at different scales. After passing through the feature extraction backbone network, four initial multi-scale features (x2, x3, x4, x5) are extracted, and their channel dimensions are (64, 128, 256, 512), as shown in formula (3):

[0023] (x2,x3,x4,x5)=ResNet(I) (3).

[0024] Preferably, the feature pyramid network is used to perform preliminary multi-scale feature fusion on the four initial multi-scale features (x2, x3, x4, x5), and the feature pyramid network outputs four fused multi-scale features (o2, o3, o4, o5), including:

[0025] The UpConv module is used as a feature pyramid network. The UpConv module consists of a 1×1 convolution layer and a 2x upsampling operation. The UpConv module is used to adjust the channel dimensions of the four initial multi-scale features (x2, x3, x4, x5) respectively, and the channel dimensions of features of different scales are adjusted to the same 256. The four initial multi-scale features (x2, x3, x4, x5) are initially fused from top to bottom to obtain the fused multi-scale features (o2, o3, o4, o5), as shown in formula (4):

[0026] (o2,o3,o4,o5)=FPN(x2,x3,x4,x5) (4).

[0027] Preferably, the four fused multi-scale features (o2, o3, o4, o5) are input into a feature aliasing module with four aliasing factors (1, 2, 4, 8), and the feature aliasing module aliases the four fused multi-scale features (o2, o3, o4, o5) from the channel dimension to the spatial dimension, and outputs four multi-scale features (p2, p3, p4, p5) containing rich spatial information, including:

[0028] The four-way aliasing factors in the feature aliasing module are set to (1, 2, 4, 8) respectively, and the four fused multi-scale features (o2, o3, o4, o5) are input into the feature aliasing module. The feature aliasing module aliases the four fused multi-scale features (o2, o3, o4, o5) from the channel dimension to the spatial dimension, and outputs four multi-scale features (p2, p3, p4, p5) containing rich spatial information;

[0029] As shown in formula (5):

[0030] pi =FSM(o i ,k),i=2,3,4,5,k=1,2,4,8 (5).

[0031] Preferably, the feature blending module blends the four fused multi-scale features (o2, o3, o4, o5) from the channel dimension to the spatial dimension, and outputs four multi-scale features (p2, p3, p4, p5) containing rich spatial information, including:

[0032] The feature aliasing module performs element-level segmentation on feature maps of different scales in the channel dimension and rearranges the elements in the channel into space. Use a 3×3 convolutional layer to adjust the number of channels to C×k 2 , get the intermediate features After batch normalization and ReLU activation layers, feature mixing is performed. Without loss of generality, assuming that the feature mixing factor is k, it means that k 2 The feature maps of the channel dimensions are mixed into the spatial dimension, so that the features of the spatial dimension change from H×W before aliasing to (H×k)×(W×k) after aliasing, and the output feature

[0033] Preferably, the four multi-scale features (p2, p3, p4, p5) containing rich spatial information are concatenated using CONCAT to obtain a multi-scale feature matrix P, including:

[0034] Use the concatenation operation to concatenate (p2, p3, p4, p5) into a whole multi-scale feature P. CONCAT represents the concatenation operation, as shown in formula (6):

[0035] P = CONCAT (p i ),i=2,3,4,5 (6).

[0036] Preferably, the method of using the channel attention module to adaptively fuse the multi-scale feature matrix P to obtain the fused multi-scale feature Q includes:

[0037] The multi-scale feature matrix P is input into the channel space attention module, and the channel attention module performs adaptive feature fusion on the multi-scale feature matrix P to obtain the fused multi-scale feature Q. CSAM represents adaptive feature fusion.

[0038] As shown in formula (7):

[0039] Q = CSAM (P) (7).

[0040] Preferably, the method of using the channel attention module to adaptively fuse the multi-scale feature matrix P to obtain the fused multi-scale feature Q includes:

[0041] Assume that the input multi-scale feature P consists of N feature maps Composition, where N is set to 4. First, as shown in formula (8):

[0042] Y=Conv(CONCAT(x0,x1,...,x N―1 )) (8)

[0043] Concatenate the input feature X and then pass it through a 3×3 convolution layer to obtain the intermediate feature

[0044] Then, as shown in formula (9):

[0045]

[0046] The channel attention weight is calculated by applying the channel attention module to feature Y. The main body of the channel attention module is the residual connection structure. Feature Y passes through channel average pooling, 1×1 convolution layer and ReLU layer, 1×1 convolution layer and Sigmoid layer in sequence to calculate the channel attention weight.

[0047] Next, as shown in formula (10):

[0048]

[0049] The channel spatial attention weight is calculated by using the spatial attention module on the output F1 of the channel attention module. The feature F1 is sequentially processed through spatial average pooling, 3×3 convolution layer and ReLU layer, 1×1 convolution layer and Sigmoid layer to calculate the channel spatial attention weight F2.

[0050] Finally, as shown in formula (11) and formula (12):

[0051] E=Sigmoid(Conv(F2))=(e0,e1,...,e N―1 ) (11)

[0052] F=CONCAT(e0x0,e1x1,...,e N―1 x N―1 ) (12)

[0053] The channel space attention weight F2 is then passed through a 1×1 convolutional layer and a Sigmoid layer to obtain E=(e0,e1,...,e N―1 ), set E=(e0,e1,...,eN―1 ) is divided into N parts along the channel dimension and weighted multiplication is performed with the corresponding input features to obtain the fused multi-scale features

[0054] The step of obtaining the scene text detection result in the scene text image to be processed according to the probability map and the threshold map includes:

[0055]

[0056] As shown in formula (13), the differentiable binarization technique is used to obtain an approximate binarization map from the probability map and the threshold map. P is a probability map, T is a threshold map that can be added to the network for adaptive learning, k is a gain factor, if the value of a certain pixel is 1, the pixel is considered to be a valid text area; if the value of a certain pixel is 0, the pixel is considered to be a non-text area. Draw the bounding box of the text instance in the input image according to the approximate binarization map to obtain the scene text detection result in the scene text image to be processed.

[0057] It can be seen from the technical solutions provided by the above embodiments of the present invention that the present invention performs feature aliasing on multi-scale features from the channel dimension to the spatial dimension, and makes fuller use of the multi-scale features, so that the algorithm can have more accurate detection performance for multi-attribute texts, reducing the problems of false detection and missed detection. The present invention fully integrates multi-scale features from the channel dimension and the spatial dimension, effectively improving the expression ability of features of different scales, and improving the performance of the text detection algorithm.

[0058] Additional aspects and advantages of the present invention will be given in part in the following description, which will become obvious from the following description, or may be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0060] Figure 1 A schematic diagram of an implementation principle of an image scene text detection method based on adaptive feature fusion is proposed for an embodiment of the present invention;

[0061] Figure 2 A processing flow chart of an image scene text detection method based on adaptive feature fusion is proposed for an embodiment of the present invention;

[0062] Figure 3 A schematic diagram of an example of a scene text image provided by an embodiment of the present invention;

[0063] Figure 4 A network structure diagram of a feature aliasing module provided in an embodiment of the present invention.

[0064] Figure 5 A network structure diagram of a channel space attention module provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0065] The embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.

[0066] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or coupling. The term "and / or" used herein includes any unit and all combinations of one or more associated listed items.

[0067] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless defined as herein.

[0068] To facilitate understanding of the embodiments of the present invention, several specific embodiments will be further explained below with reference to the accompanying drawings, and each embodiment does not constitute a limitation on the embodiments of the present invention.

[0069] In view of the problems of insufficient multi-scale feature extraction and insufficient multi-scale feature fusion in existing scene text detection algorithms, an embodiment of the present invention provides an image scene text detection method based on adaptive feature fusion. The feature aliasing module proposed in the method introduces the channel dimension features into the spatial dimension after feature aliasing, reduces the number of channels and supplements the spatial dimension features, and optimizes the feature extraction performance; the proposed channel space attention module learns the attention weights of the multi-scale feature channel dimension and the spatial dimension, superimposes them on the input features, generates multi-scale features with attention weights, and realizes adaptive multi-scale feature fusion.

[0070] In order to solve the problem that existing scene text detection algorithms are usually difficult to fully extract and fuse multi-scale features, resulting in poor detection effects of the model for multi-attribute text and complex background text, the present invention proposes an implementation principle diagram of an image scene text detection method based on adaptive feature fusion. Figure 1 As shown, the processing flow of this method is as follows Figure 2 As shown, the processing steps include the following:

[0071] Step S10: Use the ResNet backbone network to perform multi-scale feature extraction on the scene text image to be processed, and the ResNet backbone network outputs 4 initial multi-scale features (x2, x3, x4, x5). Figure 3 A schematic diagram of an example of a scene text image provided by an embodiment of the present invention.

[0072] Step S20: Use the feature pyramid network to perform preliminary multi-scale feature fusion on the four initial multi-scale features (x2, x3, x4, x5), and the feature pyramid network outputs four fused multi-scale features (o2, o3, o4, o5).

[0073] Step S30: The four fused multi-scale features (o2, o3, o4, o5) are input into a feature mixing module with four-way mixing factors of (1, 2, 4, 8) respectively. The feature mixing module mixes the four fused multi-scale features (o2, o3, o4, o5) from the channel dimension to the spatial dimension, and outputs four multi-scale features (p2, p3, p4, p5) containing rich spatial information.

[0074] Step S40: Use CONCAT to concatenate the four multi-scale features (p2, p3, p4, p5) containing rich spatial information to obtain a multi-scale feature matrix P;

[0075] Step S50: using a channel attention module to perform adaptive feature fusion on the multi-scale feature matrix P to obtain a fused multi-scale feature Q;

[0076] Step S60: performing differentiable binarization post-processing on the fused multi-scale feature Q to obtain a probability map and a threshold map, and obtaining a scene text detection result in the scene text image to be processed according to the probability map and the threshold map.

[0077] Specifically, the above step S10 includes: using ResNet18 as the backbone network, the input of which is an RGB image with a size of (H, W, 3) As shown in formula (3):

[0078] (x2,x3,x4,x5)=ResNet(I) (3)

[0079] The feature extraction backbone network ResNet consists of five convolution stages. Convolution stage 1 performs preliminary feature extraction on the input image, and the subsequent convolution stages 2 to 4 extract features of the image at different scales. After passing through the backbone network, four initial multi-scale features (x2, x3, x4, x5) are extracted, and their channel dimensions are (64, 128, 256, 512).

[0080] Specifically, the above step S20 includes: the UpConv module is composed of a 1×1 convolution layer and a 2-fold upsampling operation. After preliminary feature extraction, the UpConv module is used for features of different scales to adjust the channel dimension to the same 256; as shown in formula (4):

[0081] (o2,o3,o4,o5)=FPN(x2,x3,x4,x5) (4)

[0082] The feature pyramid preliminarily fuses these four multi-scale features from top to bottom to obtain the fused multi-scale features (o2, o3, o4, o5).

[0083] Specifically, the above step S30 includes:

[0084] Then, as shown in formula (5):

[0085] p i =FSM(o i ,k),i=2,3,4,5,k=1,2,4,8 (5)

[0086] These features are mixed from the channel dimension to the spatial dimension through a feature mixing module with four-way mixing factors (1, 2, 4, 8), and four multi-scale features (p2, p3, p4, p5) containing rich spatial information are obtained.

[0087] A network structure of a feature aliasing module provided by an embodiment of the present invention is as follows: Figure 3As shown in the figure. In the text detection model, after the input image passes through the feature pyramid backbone network, a set of multi-scale features will be generated. In order to keep the complexity of the model low, these features will be reduced in the channel dimension. At the same time, upsampling technology will be used to re-adjust these multi-scale features to the same spatial size so that they can be spliced ​​into multi-scale features. In the first step, the reduction operation of the channel dimension will effectively reduce the training parameters, but it will also lose a lot of channel dimension information. In the second step, the upsampling operation of features of different scales introduces repeated spatial information in the spatial dimension. This way of processing multi-scale features not only loses a large number of channel dimension features, but also introduces redundant features in the spatial dimension, which greatly reduces the effect of multi-scale feature extraction.

[0088] The feature aliasing module proposed in the present invention effectively solves this problem. Figure 3 As shown, the feature aliasing module adds the features of the channel dimension to the spatial dimension through feature aliasing, which not only reduces the number of channels, but also greatly enriches the features of the spatial dimension and realizes the effective utilization of the channel dimension features.

[0089] When applied to feature maps, the feature aliasing module first performs element-wise segmentation of feature maps of different scales in the channel dimension. Then, it organizes them into feature maps with richer spatial information by rearranging the elements in the channel into space. Specifically, for the input feature Use a 3×3 convolutional layer to adjust the number of channels to C×k 2 , get the intermediate features After batch normalization and ReLU (Rectified Linear Unit) activation layers, feature blending is performed. Without loss of generality, assuming that the feature blending factor is k, it means that k 2 The feature maps of the channel dimensions are mixed into the spatial dimension, so that the features of the spatial dimension change from H×W before aliasing to (h×k)×(W×k) after aliasing, and the output feature is obtained.

[0090] Compared with traditional upsampling methods such as bilinear interpolation, the feature aliasing module uses rich channel dimension features to supplement the spatial dimension features, which enables the model to learn more image details and texture information and generate more realistic and clearer feature maps. This helps to improve the expressiveness of features at different levels.

[0091] Specifically, the above step S40 includes: Next, use a concatenation operation to concatenate (p2, p3, p4, p5) into an overall multi-scale feature P. CONCAT represents a concatenation operation. As shown in formula (6):

[0092] P = CONCAT (pi ),i=2,3,4,5 (6)

[0093] Specifically, the above step S50 includes: the multi-scale feature P is taken as input and passed into the channel space attention module

[0094] As shown in formula (7):

[0095] Q=CSAM(P) (7)

[0096] The channel spatial attention module further extracts attention weights from the channel dimension and spatial dimension and fuses them into multi-scale features Q.

[0097] Figure 5 A network structure diagram of a channel space attention module provided by an embodiment of the present invention. After extracting multi-scale features, the present invention uses the channel space attention module to adaptively fuse multi-scale features, such as Figure 5 As shown in the figure, the channel-spatial attention module solves the differences between pixel channels and spatial changes in the feature map. By combining the channel-attention mechanism and the spatial attention mechanism, the channel-spatial attention module can effectively extract the attention weights of multi-scale features in the channel dimension and the spatial dimension, automatically highlight the key multi-scale text features in the channel and spatial dimensions, and enhance the prediction feature representation at the pixel level. The multi-scale features fused by the channel-spatial attention module can effectively strengthen the feature representation of occluded text in the image, enhance the model's ability to distinguish between text areas and background areas, and improve the model's ability to accurately locate and detect text instances.

[0098] Assume that the input multi-scale feature P consists of N feature maps Composition, where N is set to 4. First, as shown in formula (8):

[0099] Y=Conv(CONCAT(x0,x1,...,x N―1 )) (8)

[0100] Concatenate the input feature X and then pass it through a 3×3 convolution layer to obtain the intermediate feature

[0101] Then, as shown in formula (9):

[0102]

[0103] The channel attention weight is calculated by applying the channel attention module to feature Y. The main body of the channel attention module is the residual connection structure. The features are sequentially passed through the channel average pooling (Average Channel Pooling, ACP), 1×1 convolution layer and ReLU layer, 1×1 convolution layer and Sigmoid layer, and the channel attention weight can be calculated.

[0104] Next, as shown in formula (10):

[0105]

[0106] The channel spatial attention weight is further calculated by using the spatial attention module on the output F1 of the channel attention module. The main body of the spatial attention module is also a residual link structure. The features are sequentially passed through the average spatial pooling (ASP), 3×3 convolution layer and ReLU layer, 1×1 convolution layer and Sigmoid layer, and the channel spatial attention weight F2 can be calculated.

[0107] Finally, as shown in formula (11) and formula (12):

[0108] E=Sigmoid(Conv(F2))=(e0,e1,...,e N―1 ) (11)

[0109] F=CONCAT(e0x0,e1x1,...,e N―1 x N―1 ) (12)

[0110] The channel space attention weight F2 is then passed through a 1×1 convolutional layer and a Sigmoid layer to obtain E=(e0,e1,...,e N―1 ). It is divided into N parts along the channel dimension and weighted multiplication is performed with the corresponding input features to obtain the fused multi-scale features.

[0111] The essence of channel spatial attention is the feature aggregation process. It learns the attention weights on different channel dimensions and spatial positions, and then multiplies the input features by different weights, so that the effective multi-scale feature maps have large weights, and the invalid or ineffective multi-scale feature maps have small weights, thereby enhancing the attention to key channel dimensions and spatial positions, aggregating effective text information, and reducing the impact of background noise. Therefore, using the channel spatial attention module in text detection can improve the accuracy of text detection.

[0112] Specifically, the above step S60 includes:

[0113]

[0114] Use differentiable binarization technology to obtain an approximate binarization map from the probability map and the threshold map. As shown in formula (13), is an approximate binary map, P is a probability map, T is a threshold map that can be added to the network for adaptive learning, and k is a gain factor, which is set to 50. In the approximate binary map, the value of a pixel is 0 or 1. If the value of a pixel is 1, the pixel is considered to be a valid text area; if the value of a pixel is 0, the pixel is considered to be a non-text area. Based on the approximate binary map, the bounding box of the text instance can be drawn in the input image to obtain the text detection result.

[0115] The present invention can be applied to scene text detection tasks, such as Figure 3 Such as: road signs, billboards, shopping mall signs and text on product packaging, autonomous driving, image search, scene understanding and real-time translation.

[0116] In summary, the embodiments of the present invention solve two problems that most existing scene text detection algorithms cannot solve:

[0117] (1) Difficulty in detecting multi-attribute text. Since text in natural scenes has the characteristics of multi-scale, multi-language, rich shapes and arrangements, existing algorithms cannot accurately detect multi-attribute text. The present invention proposes a feature blending module to blend multi-scale features from the channel dimension to the spatial dimension, making fuller use of multi-scale features, so that the algorithm can have more accurate detection performance for multi-attribute text and reduce the problems of false detection and missed detection.

[0118] (2) Difficulty in text detection under complex backgrounds. The image background in natural scene images is complex and full of interference factors. Text detection is easily affected by factors such as image brightness changes, background texture interference, occlusion interference, camera jitter, lighting and shooting angle. The present invention proposes a channel space attention module, which fully integrates multi-scale features from the channel dimension and spatial dimension, effectively improves the expression ability of features of different scales, and improves the performance of the text detection algorithm.

[0119] Those skilled in the art can understand that the accompanying drawings are only schematic diagrams of an embodiment, and the modules or processes in the accompanying drawings are not necessarily required to implement the present invention.

[0120] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present invention or certain parts of the embodiments.

[0121] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0122] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for detecting text in image scenes based on adaptive feature fusion, characterized in that: include: Use the ResNet backbone network to extract multi-scale features from the scene text image to be processed. The ResNet backbone network outputs 4 initial multi-scale features (x2, x3, x4, x5); Use the feature pyramid network to perform preliminary multi-scale feature fusion on the four initial multi-scale features (x2, x3, x4, x5), and the feature pyramid network outputs four fused multi-scale features (o2, o3, o4, o5); The four fused multi-scale features (o2, o3, o4, o5) are input into a feature mixing module with four-way mixing factors (1, 2, 4, 8) respectively. The feature mixing module mixes the four fused multi-scale features (o2, o3, o4, o5) from the channel dimension to the spatial dimension, and outputs four multi-scale features (p2, p3, p4, p5) containing rich spatial information. Use CONCAT to concatenate four multi-scale features (p2, p3, p4, p5) containing rich spatial information; obtain the multi-scale feature matrix P; Use the channel attention module to perform adaptive feature fusion on the multi-scale feature matrix P to obtain the fused multi-scale feature Q; The fused multi-scale feature Q is post-processed by differentiable binarization to obtain a probability map and a threshold map, and the scene text detection result in the scene text image to be processed is obtained according to the probability map and the threshold map.

2. The method according to claim 1, characterized in that The ResNet backbone network is used to extract multi-scale features from the RGB image to be processed. The ResNet backbone network outputs 4 initial multi-scale features (x2, x3, x4, x5), including: ResNet18 is used as the feature extraction backbone network to process the RGB image of size (H, W, 3) The input is fed into the feature extraction backbone network, which consists of five convolution stages. Convolution stage 1 performs preliminary feature extraction on the input image. The subsequent convolution stages 2 to 4 extract features of the image at different scales. After passing through the feature extraction backbone network, four initial multi-scale features (x2, x3, x4, x5) are extracted, and their channel dimensions are (64, 128, 256, 512), as shown in formula (3): (x2,x3,x4,x5)=ResNet(I) (3).

3. The method according to claim 1, characterized in that The feature pyramid network is used to perform preliminary multi-scale feature fusion on the four initial multi-scale features (x2, x3, x4, x5), and the feature pyramid network outputs four fused multi-scale features (o2, o3, o4, o5), including: The UpConv module is used as a feature pyramid network. The UpConv module consists of a 1×1 convolution layer and a 2x upsampling operation. The UpConv module is used to adjust the channel dimensions of the four initial multi-scale features (x2, x3, x4, x5) respectively, and the channel dimensions of features of different scales are adjusted to the same 256. The four initial multi-scale features (x2, x3, x4, x5) are initially fused from top to bottom to obtain the fused multi-scale features (o2, o3, o4, o5), as shown in formula (4): (o2,o3,o4,o5)=FPN(x2,x3,x4,x5) (4).

4. The method according to claim 3, characterized in that The four fused multi-scale features (o2, o3, o4, o5) are input into a feature aliasing module with four aliasing factors (1, 2, 4, 8), and the feature aliasing module aliases the four fused multi-scale features (o2, o3, o4, o5) from the channel dimension to the spatial dimension, and outputs four multi-scale features (p2, p3, p4, p5) containing rich spatial information, including: The four-way aliasing factors in the feature aliasing module are set to (1, 2, 4, 8) respectively, and the four fused multi-scale features (o2, o3, o4, o5) are input into the feature aliasing module. The feature aliasing module aliases the four fused multi-scale features (o2, o3, o4, o5) from the channel dimension to the spatial dimension, and outputs four multi-scale features (p2, p3, p4, p5) containing rich spatial information; As shown in formula (5): p i =FSM(o i ,k),i=2,3,4,5,k=1,2,4,8 (5)。 5. The method according to claim 4, characterized in that The feature blending module blends the four fused multi-scale features (o2, o3, o4, o5) from the channel dimension to the spatial dimension, and outputs four multi-scale features (p2, p3, p4, p5) containing rich spatial information, including: The feature aliasing module performs element-level segmentation on feature maps of different scales in the channel dimension and rearranges the elements in the channel into space. Use a 3×3 convolutional layer to adjust the number of channels to C×k 2 , get the intermediate features After batch normalization and ReLU activation layers, feature mixing is performed. Without loss of generality, assuming that the feature mixing factor is k, it means that k 2 The feature maps of the channel dimensions are mixed into the spatial dimension, so that the features of the spatial dimension change from H×W before aliasing to (H×k)×(W×k) after aliasing, and the output feature 6. The method according to claim 4, characterized in that The four multi-scale features (p2, p3, p4, p5) containing rich spatial information are concatenated using CONCAT; Multi-scale feature matrix P, include: Use the concatenation operation to concatenate (p2, p3, p4, p5) into a whole multi-scale feature P. CONCAT represents the concatenation operation, as shown in formula (6): P=CONCAT(p i ),i=2,3,4,5 (6)。 7. The method according to claim 6, characterized in that The method of using the channel attention module to adaptively fuse the multi-scale feature matrix P to obtain the fused multi-scale feature Q includes: The multi-scale feature matrix P is input into the channel space attention module, and the channel attention module performs adaptive feature fusion on the multi-scale feature matrix P to obtain the fused multi-scale feature Q. CSAM represents adaptive feature fusion. As shown in formula (7): Q = CSAM (P) (7).

8. The method according to claim 7, characterized in that The method of using the channel attention module to adaptively fuse the multi-scale feature matrix P to obtain the fused multi-scale feature Q includes: Assume that the input multi-scale feature P consists of N feature maps Composition, where N is set to 4. First, as shown in formula (8): Y=Conv(CONCAT(x0,x1,...,x N―1 )) (8) Concatenate the input feature X and then pass it through a 3×3 convolution layer to obtain the intermediate feature Then, as shown in formula (9): The channel attention weight is calculated by applying the channel attention module to feature Y. The main body of the channel attention module is the residual connection structure. Feature Y passes through channel average pooling, 1×1 convolution layer and ReLU layer, 1×1 convolution layer and Sigmoid layer in sequence to calculate the channel attention weight. Next, as shown in formula (10): The channel spatial attention weight is calculated by using the spatial attention module on the output F1 of the channel attention module. The feature F1 is sequentially processed through spatial average pooling, 3×3 convolution layer and ReLU layer, 1×1 convolution layer and Sigmoid layer to calculate the channel spatial attention weight F2. Finally, as shown in formula (11) and formula (12): E=Sigmoid(Conv(F2))=(e0,e1,...,e N―1 ) (11) F=CONCAT(e0x0,e1x1,...,e N―1 x N―1 ) (12) The channel space attention weight F2 is then passed through a 1×1 convolutional layer and a Sigmoid layer to obtain E=(e0,e1,...,e N―1 ), set E=(e0,e1,...,e N―1 ) is divided into N parts along the channel dimension and weighted multiplication is performed with the corresponding input features to obtain the fused multi-scale features 9. The method according to any one of claims 1 to 8, characterized in that: The step of obtaining the scene text detection result in the scene text image to be processed according to the probability map and the threshold map includes: As shown in formula (13), the differentiable binarization technique is used to obtain an approximate binarization map from the probability map and the threshold map. P is a probability map, T is a threshold map that can be added to the network for adaptive learning, k is a gain factor, if the value of a certain pixel is 1, the pixel is considered to be a valid text area; if the value of a certain pixel is 0, the pixel is considered to be a non-text area. Draw the bounding box of the text instance in the input image according to the approximate binarization map to obtain the scene text detection result in the scene text image to be processed.

Citation Information

Patent Citations

  • Multi-scale text detection method and device fused with attention mechanism

    CN113743291A

  • Deep learning method for lightweight bottleneck attention mechanism

    CN114118415A

  • Scene text detection method based on feature enhanced pyramid network

    CN115131797A

  • Scene text detection method based on multi-scale feature fusion network

    CN117636324A

  • KR20220050758A