Feature extraction method and device for text recognition in images
Optimizing the feature extraction module in natural scene text recognition through neural network structure search solves the problem of insufficient performance of the feature extraction module, improves recognition performance and reduces the amount of calculations and parameters, achieving a balance between recognition accuracy and model size.
Patent Information
- Application Number
- CN202010637355.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-03
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2040-07-03
AI Technical Summary
In natural scene text recognition, the performance of the feature extraction module is insufficient, resulting in poor recognition performance, large parameters and computational complexity, and the existing design cannot achieve task adaptation.
Using the neural network structure search method, by searching the downsampling parameters and convolutional parameters of each layer, a downsampling path and a convolutional parameter path are formed. Combined with the regularization matrix, the downsampling path and operation are searched separately, using a two-step method. Search algorithm, optimize feature extraction module.
It improves text recognition performance, reduces the amount of calculations and model parameters, achieves a trade-off between recognition accuracy and model size, and improves the performance of the feature extraction module.
Smart Images

Figure CN113963338B
Abstract
Description
Technical Field
[0001] The present invention generally relates to the field of natural scene text recognition, and more specifically, to a feature extraction method and device for text recognition in an image. Background Art
[0002] Scene text recognition (STR) is a technology that recognizes text in natural images. It has attracted the attention of industry and academia due to its huge commercial value in various application fields (such as identity authentication, digital financial systems, and license plate recognition). However, natural images are diverse, with huge differences in size, font, background, and layout, making natural scene text recognition technology a huge challenge.
[0003] Figure 1 FIG. 1 is a flow chart showing the process of natural scene text recognition. Figure 1 As shown, natural scene text recognition is usually composed of three modules, namely, a correction module, a feature extraction module and a feature translation module. The correction module is used to correct the irregular text image into a text image in a standard form suitable for feature extraction operations. The feature extraction module uses a multi-layer convolutional neural network (for example, a backbone network obtained by neural network structure search) to transform the text image in a standard form input from the correction module into a feature sequence. The feature translation module is used to translate the feature sequence input from the feature extraction module into a character sequence.
[0004] In recent years, in terms of the correction module, a variety of methods have been proposed to improve the accuracy of text recognition by improving the performance of the correction module. In addition, in terms of the feature translation module, inspired by sequence-to-sequence tasks such as speech recognition and machine translation, methods based on connectionist temporal classification (CTC) and attention mechanisms have been greatly improved. However, in terms of the feature extraction module, no better design has been proposed.
[0005] The performance of the feature extraction module greatly affects the performance of text recognition. For example, simply replacing the feature extraction module from VGG to ResNet can achieve significant performance enhancement. In addition, feature extraction bears a large computational and storage load. However, the current feature extraction modules are all manually designed by human experts, which cannot achieve good task adaptation, poor recognition performance, and large parameters and computational complexity. Summary of the invention
[0006] The exemplary embodiments of the present invention are intended to solve the above technical problems, but may not solve any of the above technical problems.
[0007] According to one aspect of the present invention, there is provided a feature extraction method for text recognition in an image, comprising: receiving an image containing text; extracting features of the image using a neural network obtained through a neural network structure search; and outputting the extracted features of the image; wherein the step of the neural network structure search comprises: while fixing the convolutional parameters of each layer of the neural network, searching for downsampling parameters of each layer to form a downsampling path; searching for convolutional parameters of each layer in the downsampling path formed by the searched downsampling parameters of each layer; and determining the neural network based on the searched downsampling parameters and convolutional parameters of each layer.
[0008] Optionally, the step of searching for downsampling parameters of each layer may include:
[0009] The downsampling parameters for each layer are searched based on the following formula:
[0010]
[0011]
[0012] in,
[0013]
[0014]
[0015] Among them, L rec (N; D) represents the cross entropy loss function of the neural network N on the data set D, S represents the downsampling parameter of the neural network N, O represents the convolutional parameter of the neural network N, w represents the weight parameter of the neural network N, S * represents the optimal downsampling parameter, w * represents the optimal weight parameter, represents the fixed convolutional parameters, D val Denotes the validation data set, D tra represents the training data set, L represents the total number of layers of the neural network N, i represents the identifier of each layer of the neural network N, represents the downsampling ratio in the height direction of the i-th layer, represents the downsampling ratio in the width direction of the i-th layer, o i represents the convolution type of the i-th layer, H represents the height of the image, W represents the width of the image, c represents the overall downsampling ratio of the image in the height direction, and c2 represents the overall downsampling ratio of the image in the width direction.
[0016] Optionally, the step of searching for the downsampling parameters of each layer may include: searching for the downsampling parameters of each layer from the downsampling parameter candidates by enumeration based on the above formula.
[0017] Optionally, the downsampling parameter candidates may include (2,2), (2,1) and (1,1).
[0018] Optionally, the convolution type parameters may include the convolution kernel size and the number of channels.
[0019] Optionally, when searching for downsampling parameters of each layer, the convolution kernel size of the convolution type parameters of each layer may be fixed to 3×3, and the number of channels may be fixed to a preset value.
[0020] Optionally, the step of searching for the convolutional parameters of each layer in the downsampling path formed by the searched downsampling parameters of each layer may include: setting an importance parameter value for each convolutional parameter candidate; searching for the importance parameter value of each layer; determining the convolutional parameter candidate corresponding to the importance parameter value of each layer searched as the convolutional parameter of each layer; wherein the step of searching for the importance parameter value of each layer includes: for each layer, searching for the importance parameter value based on the following formula:
[0021]
[0022]
[0023] in,
[0024]
[0025]
[0026] Among them, L rec (N; D) represents the cross entropy loss function of the neural network N on the data set D, α represents the importance parameter value corresponding to the convolutional parameters of the neural network N, w represents the weight parameter of the neural network N, S * represents the optimal downsampling parameter of the determined neural network N, w * represents the optimal weight parameter, α * represents the optimal importance parameter value, D val Denotes the validation data set, D tra represents the training data set, r(α) represents the regularization matrix about the importance parameter value α, L represents the total number of layers of the neural network structure N, C represents the number of convolutional parameter candidates, j represents the identifier of the traversal convolutional parameter candidates, op j represents the operation on the jth convolutional parameter, FLOPS() represents the number of floating-point operations, and p j represents the probability of selecting the jth convolutional parameter, αj Represents the importance parameter value of the j-th convolutional parameter, G and β are dedicated constants, and β>0, G>1.
[0027] Optionally, the step of searching for the importance parameter value of each layer may include: performing calculations for each convolutional parameter candidate based on the following formula by a gradient descent method to search for the importance parameter value:
[0028]
[0029] in, Y=op j (X),
[0030] L(α)=r(α)·L rec (N(w * , S * , α); D val ),
[0031] Among them, reduce_sum(x) means summing all elements of matrix x, i means the i-th convolutional parameter candidate, α i represents the importance parameter value of the i-th convolutional parameter candidate, X represents the input tensor of the convolution operation, and Y represents the output operation result of the convolution operation.
[0032] Optionally, the convolutional parameter candidates may include a skip connection layer and a combination of the following items: a convolution kernel size is any one of 3 and 5, and a channel number is any one of 1, 3 and 6.
[0033] Optionally, the image may be a natural scene text image that has been rectified.
[0034] According to another aspect of the present invention, there is provided a feature extraction device for text recognition in an image, comprising: an image receiving module, configured to receive an image containing text; a feature extraction module, configured to extract features of the image using a neural network obtained through a neural network structure search; and a feature output module, configured to output the extracted features of the image; wherein the neural network structure search is performed by a neural network search module, the neural network search module being configured to: search for downsampling parameters of each layer of the neural network to form a downsampling path when the convolutional parameters of each layer of the neural network are fixed; search for convolutional parameters of each layer in the downsampling path formed by the searched downsampling parameters of each layer; determine the neural network based on the searched downsampling parameters and convolutional parameters of each layer, wherein the neural network search module is in the feature extraction device or outside the feature extraction device.
[0035] Optionally, the neural network search module can be configured to:
[0036] The downsampling parameters for each layer are searched based on the following formula:
[0037]
[0038]
[0039] in,
[0040]
[0041]
[0042] Among them, L rec (N; D) represents the cross entropy loss function of the neural network N on the data set D, S represents the downsampling parameter of the neural network N, O represents the convolutional parameter of the neural network N, w represents the weight parameter of the neural network N, S * represents the optimal downsampling parameter, w * represents the optimal weight parameter, represents the fixed convolutional parameters, D val represents the validation data set, D tra represents the training data set, L represents the total number of layers of the neural network N, i represents the identifier of each layer of the neural network N, represents the height downsampling ratio of the i-th layer, represents the width downsampling ratio of the i-th layer, o i represents the convolution type of the i-th layer, H represents the height of the image, W represents the width of the image, c1 represents the overall downsampling ratio of the image in the height direction, and c2 represents the overall downsampling ratio of the image in the width direction.
[0043] Optionally, the neural network search module can be configured to:
[0044] Based on the above formula, the downsampling parameters of each layer are searched from the downsampling parameter candidates by enumeration.
[0045] Optionally, the downsampling parameter candidates may include (2,2), (2,1) and (1,1).
[0046] Optionally, the convolution type parameters may include the convolution kernel size and the number of channels.
[0047] Optionally, when searching for downsampling parameters of each layer, the convolution kernel size of the convolution type parameters of each layer may be fixed to 3×3, and the number of channels may be fixed to a preset value.
[0048] Optionally, the neural network search module may be configured to: set an importance parameter value for each convolutional parameter candidate; search for the importance parameter value of each layer; determine the convolutional parameter candidate corresponding to the searched importance parameter value of each layer as the convolutional parameter of each layer; wherein the neural network structure search module is configured to: for each layer, search for the importance parameter value based on the following formula:
[0049]
[0050]
[0051] in,
[0052]
[0053]
[0054] Among them, L rec (N; D) represents the cross entropy loss function of the neural network N on the data set D, α represents the importance parameter value corresponding to the convolutional parameters of the neural network N, w represents the weight parameter of the neural network N, S * represents the optimal downsampling parameter of the determined neural network N, w * represents the optimal weight parameter, α * represents the optimal importance parameter value, D val represents the validation data set, D tra represents the training data set, r(α) represents the regularization matrix about the importance parameter value α, L represents the total number of layers of the neural network N, C represents the number of convolutional parameter candidates, j represents the identifier of the traversal convolutional parameter candidates, op j represents the operation on the jth convolutional parameter, FLOPS() represents the number of floating-point operations, and p j represents the probability of selecting the jth convolutional parameter, α j Represents the importance parameter value of the j-th convolutional parameter, G and β are dedicated constants, and β>0, G>1.
[0055] Optionally, the neural network search module may be configured to perform calculations for each convolutional parameter candidate based on the following formula by a gradient descent method to search for an importance parameter value:
[0056]
[0057] in, Y=op j (X), L(α)=r(α)·L rec (N(w * , S * , α); D val ),
[0058] Among them, reduce_sum(x) means summing all elements of matrix x, i means the i-th convolutional parameter candidate, α i represents the importance parameter value of the i-th convolutional parameter candidate, X represents the input tensor of the convolution operation, and Y represents the output operation result of the convolution operation.
[0059] Optionally, the convolutional parameter candidates may include a skip connection layer and a combination of the following items: a convolution kernel size is any one of 3 and 5, and a channel number is any one of 1, 3 and 6.
[0060] The image may be a natural scene text image that has been rectified.
[0061] According to another aspect of the present invention, a system is provided, comprising at least one computing device and at least one storage device storing instructions, characterized in that when the instructions are executed by the at least one computing device, they prompt the at least one computing device to execute the feature extraction method for text recognition in an image according to the present invention.
[0062] According to another aspect of the present invention, a computer-readable storage medium storing instructions is characterized in that when the instructions are executed by at least one computing device, the at least one computing device is prompted to execute the feature extraction method for text recognition in an image of the present invention.
[0063] According to the feature extraction method and feature extraction device for text recognition in images of the present invention, neural network structure search is introduced for the first time for natural scene text recognition, and the feature extraction module that has not been well studied in natural scene text recognition is improved, thereby improving the performance of text recognition.
[0064] In addition, according to the feature extraction method and feature extraction device for text recognition in images of the present invention, a search space for a specific field is introduced into natural scene text recognition, and the search space for the specific field includes the selection of downsampling paths and operations, and an innovative "two-step" search algorithm is proposed to separate the search for operations and the search for downsampling paths, thereby achieving the effect of being able to search efficiently in the search space. In addition, an additional regularization matrix is added to the search process, which effectively balances the recognition accuracy and model size.
[0065] In addition, according to the feature extraction method and feature extraction device for text recognition in an image of the present invention, the performance of text recognition is significantly improved while reducing the amount of calculation and model parameters. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] These and / or other aspects and advantages of the present invention will become clear and more easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0067] Figure 1 is a flowchart showing natural scene text recognition.
[0068] Figure 2 is a flow chart illustrating a feature extraction method for text recognition in an image according to an exemplary embodiment of the present invention.
[0069] Figure 3 is a 3D-mesh schematic diagram illustrating a down-sampling path level search according to an exemplary embodiment of the present invention.
[0070] Figure 4 is a schematic diagram illustrating an operation level search according to an exemplary embodiment of the present invention.
[0071] Figure 5 is a block diagram illustrating a feature extraction apparatus for text recognition in an image according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0072] The following description with reference to the accompanying drawings is provided to assist in a comprehensive understanding of the embodiments of the present invention as defined by the claims and their equivalents. Various specific details are included to assist in understanding, but these details are considered to be exemplary only. Therefore, one of ordinary skill in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. In addition, descriptions of well-known functions and structures are omitted for clarity and brevity.
[0073] Neural network architecture search (NAS) has achieved great success in designing data-dependent network structures, and its performance in many computer vision tasks (e.g., image classification, semantic segmentation, and object detection, etc.) has exceeded the performance of human-designed structures. In general, neural network architecture search has two important aspects, namely, search space and search algorithm. The search space defines the possibility of all candidate structures, and the search algorithm tries to search for suitable structures from the designed space. The suitable space should explore the domain information designed by humans and cover good candidates designed by humans. In addition, the suitable space should not be too large, otherwise, no algorithm can efficiently search for good structures. Therefore, designing a better search space based on domain knowledge can help to perform the search process more easily. Traditional neural network structures are designed as hyperparameters and optimized by algorithms such as reinforcement learning and evolutionary algorithms. Since these methods require full training for each sample structure, they are very time-consuming. The current single-shot neural network architecture search algorithm (OAS) significantly reduces the search time by sharing network weights during the search process. Specifically, the single-shot neural network structure search algorithm does not train the independent weights of each structure, but encodes the search space into a super network consisting of all candidate structures, and different structures inherit weights from the super network. In this way, the required structure can be searched only once by training the super network, making the neural network structure search much faster. However, the super network is only a form of search space, and the proper design of the super network is a challenging task. If the domain knowledge is not well utilized in the design, the effect of the neural network structure search may not be better than that of random search.
[0074] In order to improve the performance of feature extraction module in natural scene text recognition and reduce the amount of computation, the present invention proposes a new neural network structure search (NAS) algorithm to perform feature extraction. Specifically, the present invention proposes an automatic STR (AutoSTR) method to improve text recognition performance by searching for a data-dependent backbone network. Specifically, a search space for a specific field of STR is designed, which includes the selection of operations for each convolutional layer and the constraints on the feature downsampling path, and a novel two-step search process is proposed to separate the operation search and the downsampling path search.
[0075] Table 1 below shows a comparison table between the existing manually designed feature extraction model and the neural network structure search model including downsampling path search, wherein "AutoSTR" represents the neural network structure search model proposed by the present invention.
[0076]
Table 1
[0077]
[0078] Next, we will refer to Figures 2 to 5 A feature extraction method and apparatus for text recognition in an image according to an exemplary embodiment of the present invention will be described in detail.
[0079] Figure 2 is a flow chart illustrating a feature extraction method for text recognition in an image according to an exemplary embodiment of the present invention.
[0080] Reference Figure 2 In step 201, an image containing text is received. The image here can be a natural scene text image, or can be an image after a natural scene text image is rectified, or a natural scene text image with a standardized form after image processing (e.g., rectification) is performed on the natural scene text image, or any image containing text.
[0081] In step 203, the features of the image are extracted using a neural network obtained through a neural network structure search.
[0082] The step of searching the neural network structure includes: searching for downsampling parameters of each layer to form a downsampling path while fixing the convolutional parameters of each layer of the neural network; searching for the convolutional parameters of each layer in the downsampling path formed by the searched downsampling parameters of each layer; and determining a neural network for extracting features of the image based on the searched downsampling parameters and convolutional parameters of each layer.
[0083] In step 303, the extracted features of the image are output.
[0084] The method of neural network structure search according to an exemplary embodiment of the present invention will be described in detail below.
[0085] Since the input of STR is a natural image, the feature extraction module can be composed of a deep convolutional network, because the multiple convolutional layers of the deep convolutional network can extract the difference features well. Here, the convolutional layer can be defined as C(X; o, s h ,s w )(hereinafter referred to as C(X)), where X represents the input tensor and C represents the tensor with hyperparameters o, s h and w Specifically, o represents the type of C, such as 3×3 convolution, 5×5 depth-separable convolution, etc., s h and w Represent the downsampling ratio in the height direction and the downsampling ratio in the width direction respectively. Therefore, the deep convolutional network N can be regarded as a stack of L convolutional layers, which can be expressed as C L(...C2(C1(X))). Through the processing of the deep convolutional network N, X with input size (H, W) will be mapped to a feature map with a fixed size, which can be output to the feature translation module. Here, H and W represent the height and width of the image input to a specific extraction module, respectively.
[0086] In order to determine the data-dependent backbone network for STR, it is necessary to search for a suitable neural network structure, which can be affected by the downsampling parameters. and for convolutional parameters Therefore, the process of searching for the neural network structure can be expressed as the following formula (1).
[0087]
[0088] Here, L tra Measuring the loss of the neural network structure based on the training data set, A val The quality of the neural network structure is measured based on the validation data set. S and O are upper-level variables representing the neural network structure, which represent the function of the downsampling parameters and the function of the convolution type parameters respectively. w is a lower-level variable representing the weight parameter of the neural network structure. * represents the optimal weight parameter, P represents the constraint conditions for the height downsampling parameter and the width downsampling parameter, and can be expressed as formula (2).
[0089]
[0090] Here, c1 and c2 are two application-dependent constants, which may represent the overall downsampling ratio of the height direction of the image and the overall downsampling ratio of the width direction of the image, respectively. The constraint P is to ensure that the output size of the searched neural network structure is aligned with the input size of the subsequent feature translation module.
[0091] Since all structures that satisfy the constraint condition P need to be trained from scratch to obtain w * Therefore, it is difficult to optimize the problem in formula (1), which will cost a huge computational cost. In addition, the constraint condition P for the downsampling path is a requirement for a specific field and is completely new to neural network structure search. The existing neural network structure search algorithm cannot effectively solve the above problem.
[0092] The design of the search space is the key. The present invention designs a two-level hierarchical search space for the problem of formula (1), namely, the downsampling path level and the operation level, which respectively represent the selection ranges of S and O. The following is an example of natural scene text recognition (STR), but it is not limited to this. The search method within the scope of the present invention can also be used for text recognition in other images.
[0093] Downsampling the path-level search space
[0094] Figure 3 3D-mesh schematic diagram showing a down-sampling path level search according to an exemplary embodiment of the present invention. Figure 3 As shown, since the characters in the rectified natural scene text image are placed horizontally, a convolutional neural network (CNN) can be used to extract feature sequences, where L represents the number of layers of the convolutional neural network. In order to retain more differential features in compressed text or narrow shapes, the usual practice is to keep compressing along the height axis until the height drops to 1, but compress less along the width axis to ensure that the length of the final sequence is greater than the length of the character. The height of the input text image is unified to a fixed size, for example, 32. In order to ensure greater resolution on the horizontal axis (i.e., the width axis) to distinguish adjacent characters, the downsampling hyperparameter s can be selected from {(2,2), (2,1), (1,1)}, where (2,2) appears twice and (2,1) appears three times in the entire downsampling path to satisfy the constraint P, i.e., Thus, for example, an input text image of size (32, W) can be mapped to a feature sequence of size (1, W / 4). Therefore, the goal of the present invention is to search for the downsampling parameters of each layer to form an optimal downsampling path, for example, Figure 3 The paths formed by the bold arrows between each layer are shown in .
[0095] Operation Level Search Space
[0096] Figure 4 is a schematic diagram illustrating an operation level search according to an exemplary embodiment of the present invention. The convolutional layers of current text recognition networks generally share the same operation, such as 3×3 residual convolution. Figure 4 As shown, L represents the number of layers of the convolutional neural network, CB i represents the i-th selection block, each of which has C options for the operation, namely the basic operations op1 to op c For each convolutional layer, one operation can be selected from a selection block with C parallel operations, without changing the o of each convolutional layer. i The operations are set to be fixed. Deep convolutional networks can be obtained by stacking these selection blocks, for example, Figure 4 The selection block indicated by the arrow in the middle selects a basic operation at each layer. The amount of computation and the number of parameters can be saved by using lightweight depthwise convolution.
[0097] According to an exemplary embodiment of the present invention, parameters about the operation (i.e., convolution type parameters) include convolution kernel size and number of channels. Various convolution kernel sizes (e.g., convolution kernel size k∈{3,5}), various numbers of channels (e.g., number of channels e∈{1,3,6}), and jump connection layers can be used to establish a mobile reverse bottleneck convolution layer (MBConv) set. For each convolution layer, an operation can be selected from the MBConv set, that is, a convolution type parameter is selected. For example, the MBConv set can be shown in Table 1 below, but is not limited thereto, and any other possible MBConv set can also be used.
[0098] Table 1
[0099]
[0100] For the above-mentioned downsampling path level search space and operation level search space, for example, when the number of layers L of the deep convolutional network is 15, there are 30030 possible candidate downsampling paths in the downsampling path level search space. Assuming that there are 7 candidate operations in Table 1 in the operation level search space, it will lead to 30030×7 15 ≈1.43×10 17 possible neural network structures, that is, the number of neural network structures to be searched is too large and the computational complexity is too high. Therefore, directly optimizing the problem in formula (1) would be a huge challenge.
[0101] In order to effectively search for the neural network structure and reduce the amount of computation, the present invention provides a "two-step method", that is, according to experience, the selection of the downsampling path and the operation of the operation are almost orthogonal to each other, so the process of searching S and O can be separated into the process of searching S and the process of searching O. Specifically, in the first search step, the operation O of each convolution layer can be fixed (that is, the convolution type parameters are fixed). For example, the convolution kernel size can be fixed to but not limited to a 3×3 residual convolution layer, and the number of channels can be fixed to a predetermined value k, where k can be set as needed. Subsequently, with the fixed operation O, the downsampling path S is searched, that is, the convolution downsampling parameters of each convolution layer are searched. In the second search step, on the searched downsampling path, the operation O of each layer is searched, that is, the convolution type parameters of the convolution operation of each layer are searched.
[0102] Hereinafter, the first search step according to an exemplary embodiment of the present invention, that is, a method of searching for a down-sampling path S with the operation O fixed, will be described in detail.
[0103] When the operation O is fixed, formula (1) can be transformed into the following formula (3), and the downsampling path S (ie, the downsampling parameters of each convolutional layer) is searched by formula (3).
[0104]
[0105]
[0106] in,
[0107]
[0108] Among them, L rec (N; D) represents the cross entropy loss function of the neural network structure N with respect to the data set D, S represents the downsampling parameter of the neural network structure N, O represents the convolutional parameter of the neural network structure N, w represents the weight parameter of the neural network structure N, S * represents the optimal downsampling parameter, w * represents the optimal weight parameter, represents the fixed convolutional parameters, D val represents the validation data set, D tra represents the training data set, L represents the total number of layers of the neural network structure N, i represents the identifier of each layer of the neural network structure N, represents the height downsampling ratio of the i-th layer, represents the width downsampling ratio of the i-th layer, o i represents the convolution type of the i-th layer, H represents the height of the image, W represents the width of the image, c represents the overall downsampling ratio of the image in the height direction, and c2 represents the overall downsampling ratio of the image in the width direction.
[0109] According to an exemplary embodiment of the present invention, the downsampling parameters of each layer can be searched from the downsampling parameter candidates (e.g., {(2,2), (2,1), (1,1)}) by enumeration based on formula (3). Specifically, in order to meet the constraint condition P, in the downsampling path, only the convolution downsampling parameters of two convolutional layers are (2,2) (hereinafter, referred to as downsampling type A) and the convolution downsampling parameters of three convolutional layers are (2,1) (hereinafter, referred to as downsampling type B), and the convolution downsampling parameters of other convolutional layers are (1,1). The same number of layers can be set for each convolution stage. For example, for a network with L=15, downsampling can be set at layers 1, 4, 7, 10, and 13, and the network can be equally divided into 5 stages. Therefore, the downsampling strategies of layers 1, 4, 7, 10, and 13 can be divided into 10 typical paths, namely, AABBB, ABABB, ABBAB, ABBBA, BAABB, BABAB, BABBA, BBAAB, BBAAB, BBABA, and BBBAA. A small network search can be performed on these enumerated typical paths to find paths close to S *In addition, by learning skip connections in the second search step, the number of layers in each convolutional stage can be reduced.
[0110] Next, the second search step according to an exemplary embodiment of the present invention, that is, a method of searching for operation O of each layer on the searched downsampling path, will be described in detail.
[0111] According to an exemplary embodiment of the present invention, an importance parameter value may be set for each convolutional parameter candidate; the importance parameter value of each layer may be searched; and the convolutional parameter candidate corresponding to the searched importance parameter value of each layer may be determined as the convolutional parameter of each layer.
[0112] Specifically, a hyperparameter α can be j With each operation op j (i.e., each convolutional parameter) is associated with the hyperparameter α j This allows the classification of a particular operation to be continuous in a selection block. That is, obtained by the flexible maximum transfer function of α, p j Yes Figure 4 The probability of selecting the i-th operation is shown in . The output Y of the selection block depends randomly on the input X, that is, Y = op j (X), with probability p j In this way, all candidate operations are encoded as consecutive over-parameterized blocks, p j Indicates the importance of the operation, therefore, α can be the importance parameter of each convolutional parameter.
[0113] Since the convolution operation not only affects the recognition accuracy, but also affects the computational complexity and size of the searched backbone network, in order to balance the complexity and performance of the searched backbone network, a regularization matrix for the structure α is first introduced, as shown in the following formula (4).
[0114]
[0115] Among them, G and β are dedicated constants, and β>0, G>1, FLOPS() represents the number of floating point operations, L represents the total number of layers of the neural network structure N, C represents the number of convolutional parameter candidates, j represents the identifier of traversing convolutional parameter candidates, op j represents the operation on the jth convolutional parameter, p j represents the probability of selecting the jth convolutional parameter, α j Represents the importance parameter value of the j-th convolutional parameter.
[0116] Subsequently, formula (1) can be transformed into the following formula (5), and the importance parameter value α of each convolutional layer can be searched by formula (5).
[0117]
[0118] Among them, L rec (N; D) represents the cross entropy loss function of the neural network structure N with respect to the data set D, α represents the importance parameter value corresponding to the convolutional parameters of the neural network structure N, w represents the weight parameter of the neural network structure N, S * represents the optimal downsampling parameter of the determined neural network structure N, w * represents the optimal weight parameter, α * represents the optimal importance parameter value, D val represents the validation data set, D tra represents the training data set, and r(α) represents the regularization matrix with respect to the importance parameter value α.
[0119] It can be seen that in L rec Under the same circumstances, r(α) can make the architecture have fewer FLOPS. Therefore, by optimizing the recognition loss with complex regularization, the trade-off between accuracy and model size can be effectively achieved.
[0120] According to an exemplary embodiment of the present invention, calculation may be performed for each convolutional parameter candidate based on the following formula (6) by a gradient descent method to search for an importance parameter value.
[0121]
[0122] in, Y=op j (X), L(α)=r(α)·L rec (N(w * , S * , α); D val ),
[0123] Among them, reduce_sum(x) means summing all elements of matrix x, i means the i-th convolutional parameter candidate, j means the identifier of traversing convolutional parameter candidates, α i represents the importance parameter value of the i-th convolutional parameter candidate, X represents the input tensor of the convolution operation, and Y represents the output operation result of the convolution operation.
[0124] In the process of searching for operation O at each layer, only one operation path (such as Figure 4 As shown in the figure, the back propagation is activated, so it is actually necessary to allocate memory only to store the activated operations, without allocating memory to store all the inactivated operations, which makes the GPU memory update process friendly.
[0125] Figure 5is a block diagram illustrating a feature extraction apparatus for text recognition in an image according to an exemplary embodiment of the present invention.
[0126] Reference Figure 5 According to an exemplary embodiment of the present invention, a feature extraction device for text recognition in an image (hereinafter referred to as a feature extraction device) includes an image receiving module 501, a feature extraction module 502, and a feature output module 503. According to an exemplary embodiment of the present invention, the feature extraction device may further include a neural network search module 504. According to another exemplary embodiment of the present invention, the feature extraction device may not include the neural network search module 504, and may receive the searched neural network from the neural network search module 504 through various communication methods.
[0127] The image receiving module 501 can receive an image containing text. The image here can be a natural scene text image, or can be an image of a natural scene text image after correction processing, or a text image with a canonical form after image processing (e.g., correction processing) of the natural scene text image, or any image containing text.
[0128] The feature extraction module 502 may extract features of the image using a neural network obtained through a neural network structure search performed by the neural network search module 504 .
[0129] The feature output module 503 may output the extracted features of the image.
[0130] The neural network search module 504 can search for downsampling parameters of each layer of the neural network to form a downsampling path while fixing the convolution parameters of each layer; can search for the convolution parameters of each layer in the downsampling path formed by the searched downsampling parameters of each layer; and can determine a neural network for extracting features of the image based on the searched downsampling parameters and convolution parameters of each layer.
[0131] The specific method for performing neural network structure search by the neural network search module 504 according to the exemplary embodiment of the present invention has been described in detail above and will not be repeated here.
[0132] According to the feature extraction method and feature extraction device for text recognition in images of the present invention, neural network structure search is introduced for the first time for natural scene text recognition, and the feature extraction module that has not been well studied in natural scene text recognition is improved, thereby improving the performance of text recognition.
[0133] In addition, according to the feature extraction method and feature extraction device for text recognition in images of the present invention, a search space for a specific field is introduced into natural scene text recognition, and the search space for the specific field includes the selection of downsampling paths and operations, and an innovative "two-step" search algorithm is proposed to separate the search for operations and the search for downsampling paths, thereby achieving the effect of being able to search efficiently in the search space. In addition, an additional regularization matrix is added to the search process, which effectively balances the recognition accuracy and model size.
[0134] In addition, according to the feature extraction method and feature extraction device for text recognition in an image of the present invention, the performance of text recognition is significantly improved while reducing the amount of calculation and model parameters.
[0135] The above has been referred to Figures 2 to 5 A feature extraction method and a feature extraction apparatus for text recognition in an image according to an exemplary embodiment of the present invention are described.
[0136] Figure 5 Each module shown may be configured as software, hardware, firmware, or any combination of the above items to perform a specific function. For example, each module may correspond to a dedicated integrated circuit, or may correspond to a pure software code, or may correspond to a module that combines software and hardware. In addition, one or more functions implemented by the security monitoring module may also be uniformly executed by components in a physical entity device (e.g., a processor, a client, or a server, etc.).
[0137] In addition, refer to Figure 2 The described method can be implemented by a program (or instruction) recorded on a computer-readable storage medium. For example, according to an exemplary embodiment of the present invention, a computer-readable storage medium storing instructions can be provided, wherein when the instructions are executed by at least one computing device, the at least one computing device is prompted to perform the feature extraction method for text recognition in an image according to the present invention.
[0138] The computer program in the computer-readable storage medium can be run in an environment deployed in a computer device such as a client, a host, an agent device, a server, etc. It should be noted that the computer program can also be used to perform additional steps in addition to the above steps or perform more specific processing when performing the above steps. The contents of these additional steps and further processing have been described in reference to Figure 2 It is mentioned in the description of the related method, so it will not be repeated here to avoid repetition.
[0139] It should be noted that the various modules according to the exemplary embodiments of the present invention can completely rely on the operation of the computer program to realize the corresponding functions, that is, each module corresponds to each step in the functional architecture of the computer program, so that the entire system is called through a special software package (for example, lib library) to realize the corresponding function.
[0140] on the other hand, Figure 5 The modules shown may also be implemented by hardware, software, firmware, middleware, microcode, or any combination thereof. When implemented by software, firmware, middleware, or microcode, the program code or code segment for performing the corresponding operation may be stored in a computer-readable medium such as a storage medium, so that the processor may perform the corresponding operation by reading and running the corresponding program code or code segment.
[0141] For example, an exemplary embodiment of the present invention can also be implemented as a computing device, which includes a storage component and a processor, wherein a set of computer-executable instructions is stored in the storage component. When the set of computer-executable instructions is executed by the processor, a feature extraction method for text recognition in an image according to an exemplary embodiment of the present invention is performed.
[0142] Specifically, the computing device can be deployed in a server or client, or can be deployed on a node device in a distributed network environment. In addition, the computing device can be a PC, a tablet device, a personal digital assistant, a smart phone, a web application, or other device capable of executing the above instruction set.
[0143] Here, the computing device is not necessarily a single computing device, but may also be any device or circuit collection that can execute the above instructions (or instruction sets) individually or jointly. The computing device may also be part of an integrated control system or system manager, or may be configured as a portable electronic device that is interconnected with a local or remote (e.g., via wireless transmission) interface.
[0144] In a computing device, a processor may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller, or a microprocessor. By way of example and not limitation, a processor may also include an analog processor, a digital processor, a microprocessor, a multi-core processor, a processor array, a network processor, etc.
[0145] According to the exemplary embodiment of the present invention, some operations described in the feature extraction method for text recognition in an image can be implemented by software, some operations can be implemented by hardware, and in addition, these operations can also be implemented by a combination of software and hardware.
[0146] The processor may execute instructions or codes stored in one of the storage components, which may also store data. Instructions and data may also be sent and received over a network via a network interface device, which may employ any known transmission protocol.
[0147] The storage component may be integrated with the processor, for example, RAM or flash memory is arranged within an integrated circuit microprocessor, etc. In addition, the storage component may include a separate device, such as an external disk drive, a storage array, or any other storage device that can be used by a database system. The storage component and the processor may be operatively coupled, or may communicate with each other, such as through an I / O port, a network connection, etc., so that the processor can read files stored in the storage component.
[0148] In addition, the computing device may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, a mouse, a touch input device, etc.) All components of the computing device may be connected to each other via a bus and / or a network.
[0149] The feature extraction method for text recognition in an image according to an exemplary embodiment of the present invention can be described as various interconnected or coupled functional blocks or functional diagrams. However, these functional blocks or functional diagrams can be equally integrated into a single logical device or operated according to non-exact boundaries.
[0150] Therefore, refer to Figure 2 The described feature extraction method for text recognition in an image may be implemented by a system including at least one computing device and at least one storage device storing instructions.
[0151] According to an exemplary embodiment of the present invention, at least one computing device is a computing device for executing operations performed by a security monitoring module according to an exemplary embodiment of the present invention, and a computer executable instruction set is stored in the storage device. When the computer executable instruction set is executed by the at least one computing device, the execution reference Figure 2 The described feature extraction method for text recognition in images.
[0152] The above describes various exemplary embodiments of the present invention, it should be understood that the above description is only exemplary, not exhaustive, and the present invention is not limited to the disclosed exemplary embodiments. Without departing from the scope and spirit of the present invention, many modifications and changes are obvious to those of ordinary skill in the art. Therefore, the scope of protection of the present invention should be based on the scope of the claims.
Claims
1. A feature extraction method for text recognition in an image, comprising: receiving an image containing text; Extracting features of the image using a neural network obtained through neural network structure search; Outputting the extracted features of the image; The step of searching the neural network structure includes: With the convolutional parameters of each layer of the neural network fixed, the downsampling parameters of each layer are searched to form a downsampling path; the convolutional parameters of each layer are searched in the downsampling path formed by the searched downsampling parameters of each layer; and the neural network is determined based on the searched downsampling parameters and convolutional parameters of each layer.
2. The feature extraction method according to claim 1, wherein: The steps to search for downsampling parameters at each layer include: The downsampling parameters for each layer are searched based on the following formula: in, Among them, L rec (N; D) represents the cross entropy loss function of the neural network N on the data set D, S represents the downsampling parameter of the neural network N, O represents the convolutional parameter of the neural network N, w represents the weight parameter of the neural network N, S * represents the optimal downsampling parameter, w * represents the optimal weight parameter, represents the fixed convolutional parameters, D val represents the validation data set, D tra represents the training data set, L represents the total number of layers of the neural network N, i represents the identifier of each layer of the neural network N, represents the downsampling ratio in the height direction of the i-th layer, represents the downsampling ratio in the width direction of the i-th layer, o i represents the convolution type of the i-th layer, H represents the height of the image, W represents the width of the image, c1 represents the overall downsampling ratio of the image in the height direction, and c2 represents the overall downsampling ratio of the image in the width direction.
3. The feature extraction method according to claim 2, wherein: The steps to search for downsampling parameters at each layer include: Based on the above formula, the downsampling parameters of each layer are searched from the downsampling parameter candidates by enumeration.
4. The feature extraction method according to claim 3, wherein: The downsampling parameter candidates include (2,2), (2,1) and (1,1).
5. The feature extraction method according to claim 1, wherein: Convolution parameters include convolution kernel size and number of channels.
6. The feature extraction method according to claim 5, wherein: When searching for the downsampling parameters of each layer, the convolution kernel size of the convolutional parameters of each layer is fixed to 3×3, and the number of channels is fixed to a preset value.
7. The feature extraction method according to claim 1, wherein: The step of searching for the convolutional parameters of each layer in the downsampling path formed by the searched downsampling parameters of each layer includes: Setting an importance parameter value for each convolutional parameter candidate; Search for importance parameter values at each layer; Determine the convolutional parameter candidates corresponding to the searched importance parameter values of each layer as the convolutional parameters of each layer; The steps of searching the importance parameter value of each layer include: For each layer, the importance parameter value is searched based on the following formula: s.t.w * =argmin w L rec (N(w,S * ,α);D tra ), in, Among them, L rec (N; D) represents the cross entropy loss function of the neural network N on the data set D, α represents the importance parameter value corresponding to the convolutional parameters of the neural network N, w represents the weight parameter of the neural network N, S * represents the optimal downsampling parameter of the determined neural network N, w * represents the optimal weight parameter, α * represents the optimal importance parameter value, D val represents the validation data set, D tra represents the training data set, r(α) represents the regularization matrix about the importance parameter value α, L represents the total number of layers of the neural network structure N, C represents the number of convolutional parameter candidates, j represents the identifier of the traversal convolutional parameter candidates, op j represents the operation on the jth convolutional parameter, FLOPS() represents the number of floating-point operations, and p j represents the probability of selecting the jth convolutional parameter, α j Represents the importance parameter value of the j-th convolutional parameter, G and β are dedicated constants, and β>0, G>1.
8. The feature extraction method according to claim 7, wherein: The steps to search for the importance parameter value for each layer include: By gradient descent, calculations are performed for each convolutional parameter candidate based on the following formula to search for important parameter values: in, L(a)=r(a)·L rec (N(w * ,S * ,a);D val ), Among them, reduce_sum(x) means summing all elements of matrix x, i means the i-th convolutional parameter candidate, j means the identifier of traversing convolutional parameter candidates, α i represents the importance parameter value of the i-th convolutional parameter candidate, X represents the input tensor of the convolution operation, and Y represents the output operation result of the convolution operation.
9. The feature extraction method according to claim 7, wherein: The convolutional parameter candidates include a skip connection layer and a combination of the following items: a convolution kernel size is any one of 3 and 5, and a channel number is any one of 1, 3 and 6.
10. The feature extraction method according to claim 1, wherein: The image is a natural scene text image that has been rectified.
11. A feature extraction device for text recognition in an image, comprising: An image receiving module, configured to receive an image containing text; A feature extraction module, configured to extract features of the image using a neural network obtained through a neural network structure search; A feature output module, configured to output the extracted features of the image; The neural network structure search is performed by a neural network search module, which is configured to: search for downsampling parameters of each layer to form a downsampling path when the convolutional parameters of each layer of the neural network are fixed; search for the convolutional parameters of each layer in the downsampling path formed by the searched downsampling parameters of each layer; determine the neural network based on the searched downsampling parameters and convolutional parameters of each layer. Wherein, the neural network search module is in the feature extraction device or outside the feature extraction device.
12. The feature extraction device according to claim 11, wherein: The neural network search module is configured as: The downsampling parameters for each layer are searched based on the following formula: in, Among them, L rec (N; D) represents the cross entropy loss function of the neural network N on the data set D, S represents the downsampling parameter of the neural network N, O represents the convolutional parameter of the neural network N, w represents the weight parameter of the neural network N, S * represents the optimal downsampling parameter, w * represents the optimal weight parameter, represents the fixed convolutional parameters, D val represents the validation data set, D tra represents the training data set, L represents the total number of layers of the neural network N, i represents the identifier of each layer of the neural network N, represents the height downsampling ratio of the i-th layer, represents the width downsampling ratio of the i-th layer, o i represents the convolution type of the i-th layer, H represents the height of the image, W represents the width of the image, c1 represents the overall downsampling ratio of the image in the height direction, and c2 represents the overall downsampling ratio of the image in the width direction.
13. The feature extraction device according to claim 12, wherein: The neural network search module is configured as: Based on the above formula, the downsampling parameters of each layer are searched from the downsampling parameter candidates by enumeration.
14. The feature extraction device according to claim 13, wherein: The downsampling parameter candidates include (2,2), (2,1) and (1,1).
15. The feature extraction device according to claim 11, wherein: Convolution parameters include convolution kernel size and number of channels.
16. The feature extraction device according to claim 15, wherein: When searching for the downsampling parameters of each layer, the convolution kernel size of the convolutional parameters of each layer is fixed to 3×3, and the number of channels is fixed to a preset value.
17. The feature extraction device according to claim 11, wherein: The neural network search module is configured as: Setting an importance parameter value for each convolutional parameter candidate; Search for importance parameter values at each layer; Determine the convolutional parameter candidates corresponding to the searched importance parameter values of each layer as the convolutional parameters of each layer; The neural network structure search module is configured to search for importance parameter values for each layer based on the following formula: s.t.w * =argmin w L rec (N(w,S * ,α);D tra ), in, Among them, L rec (N; D) represents the cross entropy loss function of the neural network N on the data set D, α represents the importance parameter value corresponding to the convolutional parameters of the neural network N, w represents the weight parameter of the neural network N, S * represents the optimal downsampling parameter of the determined neural network N, w * represents the optimal weight parameter, α * represents the optimal importance parameter value, D val represents the validation data set, D tra represents the training data set, r(α) represents the regularization matrix about the importance parameter value α, L represents the total number of layers of the neural network N, C represents the number of convolutional parameter candidates, j represents the identifier of the traversal convolutional parameter candidates, op j represents the operation on the jth convolutional parameter, FLOPS() represents the number of floating-point operations, and p j represents the probability of selecting the jth convolutional parameter, α j Represents the importance parameter value of the j-th convolutional parameter, G and β are dedicated constants, and β>0, G>1.
18. The feature extraction device according to claim 17, wherein: The neural network search module is configured as: By gradient descent, calculations are performed for each convolutional parameter candidate based on the following formula to search for important parameter values: in, L(a)=r(a)·L rec (N(w * ,S * ,a);D val ), Among them, reduce_sum(x) means summing all elements of matrix x, i means the i-th convolutional parameter candidate, j means the identifier of traversing convolutional parameter candidates, α i represents the importance parameter value of the i-th convolutional parameter candidate, X represents the input tensor of the convolution operation, and Y represents the output operation result of the convolution operation.
19. The feature extraction device according to claim 17, wherein: The convolutional parameter candidates include a skip connection layer and a combination of the following items: a convolution kernel size is any one of 3 and 5, and a channel number is any one of 1, 3 and 6.
20. The feature extraction device according to claim 11, wherein: The image is a natural scene text image that has been rectified.
21. A system comprising at least one computing device and at least one storage device storing instructions, characterized in that: When the instructions are executed by the at least one computing device, the at least one computing device is prompted to perform the feature extraction method according to any one of claims 1 to 10.
22. A computer-readable storage medium storing instructions, characterized in that: When the instructions are executed by at least one computing device, the at least one computing device is prompted to perform the feature extraction method according to any one of claims 1 to 10.
