A method for building an image classification network with a fusable multi-branch architecture
By fusing the convolutional modules in a multi-branch image classification network, the problem of slow speed of multi-branch networks on computer hardware is solved, and the inference speed is improved without reducing accuracy, making it suitable for real-time inference applications.
Patent Information
- Application Number
- CN202411215351.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2044-08-30
AI Technical Summary
Existing computer hardware is slow and performs poorly in parallel processing when running multi-branch networks, especially when deployed on CPUs. Therefore, there is an urgent need in the field for an innovative approach that achieves both speed and performance.
A method for constructing an image classification network with a fusionable multi-branch architecture is proposed. This method integrates the standard convolutional module, group convolutional module, and Dirac convolutional module in the multi-branch architecture network. A fusion algorithm is used to merge the multi-path convolutional kernels into a single-path convolutional kernel, thereby improving the inference speed without changing the accuracy.
Without compromising accuracy, it significantly improves the inference speed of image classification networks, making it suitable for real-time inference applications such as autonomous driving, autonomous navigation, and missile guidance.
Smart Images

Figure CN119206307B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer vision, and in particular to a method for building an image classification network with a fusable multi-branch architecture. BACKGROUND
[0002] Image classification in computer vision is a technology that allows machines to classify images by simulating the perception and understanding abilities of the human eye. With the help of algorithms, machines can recognize objects, targets, and text in images. By combining advanced technologies such as artificial intelligence and big data, computer vision algorithms can learn from vast amounts of data, achieving the same or even surpassing human accuracy, thereby reducing labor costs and improving device efficiency and performance.
[0003] Currently, convolutional neural networks in artificial intelligence have been widely used in computer vision algorithms. To improve performance, a multi-branch network with multiple convolution kernels in parallel is generally used to enhance the performance of the algorithm model. For example, multiple convolution kernels of different sizes are used in parallel, and then convolution operations are performed on the image to capture multi-scale information and improve model performance. However, due to the limitations of computer hardware, the computer hardware (GPU or CPU) tends to be slow and has poor parallelism when running a multi-branch network, especially when deployed on a CPU. Therefore, there is an urgent need for an innovative method to overcome these problems and achieve fast and good results. SUMMARY
[0004] The present application provides a method for building an image classification network with a fusable multi-branch architecture to solve the above problems in the prior art.
[0005] To solve the above technical problems, the present application adopts the following technical solutions:
[0006] The present application provides a method for building an image classification network with a fusable multi-branch architecture, comprising:
[0007] Step one, building a multi-branch architecture network including a head module containing a standard convolution module, an over module containing a standard convolution module, a fusable module, and a classification head module;
[0008] Step two, training and tuning the multi-branch architecture network, and obtaining the optimal performance weight;
[0009] Step three, based on the optimal performance weight, for the standard convolution module in the multi-branch architecture network, using fusion algorithm 2 to fuse the convolution kernels and BN n into one convolution kernel Merging two layers into one layer and removing all BN from the network;
[0010] Step four, perform the following operations on all fusible modules in the network:
[0011] 1) Use fusion algorithm 1 to fill the multi-standard convolution and into a group convolution kernel gconv with a group number of 3 5×5 At this time, the multi-standard convolution and becomes a single group convolution gconv 5×5 ;
[0012] 2) On the basis of 1), process the residual edge with two Dirac convolution modules, and the Dirac convolution kernel is dracconv 5×5 ; In this way, the feature map value of the residual edge is ensured not to change, and the residual edge is convoluted, which is convenient for subsequent fusion;
[0013] 3) On the basis of 2), use fusion algorithm 1 and fusion algorithm 3 to fuse the convolution kernels and activation functions of the standard convolution modules, group convolution modules and Dirac convolution modules located in the same layer. At this time, the double convolution has become a single convolution, and the residual edge is “absorbed”;
[0014] Step five, output the final image classification network with a fusible multi-branch architecture.
[0015] On this basis, the application can also be improved as follows:
[0016] 1) The standard convolution module is composed of one standard convolution kernel with a step of 1, one batch normalization function BN and one activation function, wherein:
[0017] The name of the standard convolution kernel is defined as The standard convolution expression is:
[0018]
[0019] Where f( ) is the convolution kernel operation function, k is the convolution kernel size parameter, n is the convolution kernel serial number, w is the convolution kernel coefficient matrix, b is the convolution kernel bias coefficient, and x is the input.
[0020] The name of BN is defined as BN n , and the expression is:
[0021]
[0022] Where f( ) is the BN operation function, n is the BN serial number, γ is the BN weight coefficient, β is the BN bias coefficient, x is the input, μ is the mean of x, σ is the standard deviation of x, and ∈ is a constant ( ∈ = 10 -5 ).
[0023] The activation function is selected as ReLU, the name of which is defined as ReLU, and the expression can be written as:
[0024]
[0025] wherein f() is the ReLU operation function, and x is the input;
[0026] The output of the single standard convolution module is:
[0027]
[0028] 2) Dirac convolution module
[0029] The Dirac convolution module is composed of a Dirac convolution kernel with a step of 1 and an identity function, wherein:
[0030] The Dirac convolution kernel is named as The Dirac convolution expression is:
[0031]
[0032] wherein f() is the convolution kernel operation function, k is the convolution kernel size parameter, n is the convolution kernel serial number, w drac is the convolution kernel coefficient matrix, b drac is the convolution kernel bias coefficient, and x is the input;
[0033] The activation function of the module is named as dracact, and the expression is:
[0034] f dracact (x) = 1, x ∈ R;
[0035] wherein f dracact () is the operation function of the activation function, and x is the input.
[0036] On the basis, the application can also be improved as follows:
[0037] 1) Head module
[0038] The head module is composed of a standard convolution kernel conv^(3x3) with a step of 2 and a ReLU function, and plays a role of reducing sampling;
[0039] 2) Transition module
[0040] The transition module is consistent with the structure of the head module, is composed of a standard convolution kernel conv^(3x3) with a step of 2 and a ReLU function, and plays a role of reducing sampling;
[0041] 3) Basic module
[0042] The basic module has a two-layer structure, the first layer is composed of one step 1 BN n And ReLU, the second layer is composed of three standard convolution modules with step 1, and the convolution kernel sizes are 1*1, 3*3 and 5*5 respectively; The specific process is as follows:
[0043] a) The input x is first subjected to BN0 and ReLU for nonlinear processing, and each feature map in the input x will be fused ;
[0044] b) The results of step a) will be subjected to multi-scale feature extraction respectively to obtain more diverse information; and subjected to regularization and nonlinearization through BN1, BN2, BN3 and ReLU functions;
[0045] c) The feature maps obtained in step b) will be spliced along the channel into a new feature map, which is added to the original input x to obtain the output y of the basic module;
[0046] 4) Classification head module
[0047] The classification head module is composed of a global average pooling layer GAP and a fully connected layer FC, which is used for feature compression and class probability calculation.
[0048] On the basis, the application can also be improved as follows: the fusion algorithm 1 specifically comprises:
[0049] The fusion of any two convolution kernels is regarded as the fusion of a coefficient matrix w and the fusion of a bias coefficient b; first, the multiple convolution kernels to be fused are padded to the same size, and then an equivalent grouped convolution module is used to replace them; for the padding part, first, the sizes of all grouped convolution kernels to be fused are counted, and the maximum one is taken as the target, then the non-maximum convolution kernel is zero-filled to the size equal to the maximum convolution kernel;
[0050] Wherein, the fused coefficient matrix w can be regarded as a plurality of convolution kernel coefficient matrices w n along the channel dimension, and its expression is:
[0051] w={w1,w2,...,w n}
[0052] Wherein, n is the convolution kernel number, w n is the nth convolution kernel coefficient matrix;
[0053] The bias coefficient b is a one-dimensional vector, and the splicing along its dimension direction is adopted, and its expression b * is:
[0054] b={b1,b2,...,b n}
[0055] Where n is the convolution kernel number, b n is the nth convolution kernel bias coefficient;
[0056] The expression of w and b is consistent with the expression of the grouped convolution kernel ; {w1, w2,..., w n} spliced along the channel conforms to The coefficient matrix w g expression, and b The expression of b g bias; therefore, a multiple convolution kernel is replaced by a grouped convolution kernel; the final The channel input dimension of is equal to the sum of the channel input dimensions of each convolution kernel before fusion, and the channel output dimension is equal to the sum of the channel output dimensions of each convolution kernel before fusion; therefore, the channel dimension of the input x and the output y is doubled, so that the dimensions of x and y are restored to normal by slicing.
[0057] On this basis, the present application can also be improved as follows: the fusion algorithm 2 specifically includes:
[0058] For the standard convolution module, the output y is deformed into:
[0059]
[0060] Where, the part of x>0 is a new convolution kernel The expression is:
[0061]
[0062] Where, f() is an operation function, w * is the new convolution kernel weight coefficient matrix, b * is the new convolution kernel bias coefficient, and the remaining parameters are as shown in the foregoing;
[0063] The new convolution kernel fuses the and BN n in the standard convolution kernel into a new convolution kernel.
[0064] On this basis, the present application can also be improved as follows: the fusion algorithm 3 specifically includes:
[0065] In order to ensure that the output of the Dirac convolution module, the standard convolution module and the grouped convolution module is unchanged, an activation function is adopted:
[0066]
[0067] wherein x res is the feature map of the residual edge; the activation function applies to the part in the feature map belonging to the residual edge ReLU , and applies the identity mapping function f dracact to the non-residual part.
[0068] The present application provides the beneficial effects of:
[0069] The present application first proposes an image classification network with a multi-branch architecture, and then proposes three fusion algorithms (fusion algorithms 1, 2 and 3) to fuse the multi-path convolution module in the network into a single-path convolution module, which improves the network inference speed without affecting the accuracy. In summary, the present application provides an accurate, efficient and practical method, which improves the inference efficiency of the multi-branch architecture network, and can provide a general method for real-time inference, such as automatic driving, automatic navigation, missile guidance, low-latency response devices, etc.
[0070] The advantages of the additional aspects of the present application will be partially given in the following description, partially become obvious from the following description, or be known by the practice of the present application. BRIEF DESCRIPTION OF DRAWINGS
[0071] Figure 1 It is a network overall architecture diagram of the embodiment of the present application.
[0072] Figure 2 It is a convolution module diagram of the embodiment of the present application.
[0073] Figure 3 It is a module diagram in the network of the embodiment of the present application.
[0074] Figure 4 It is a convolution kernel filling process diagram of the embodiment of the present application.
[0075] Figure 5 It is a fusion algorithm 2 effect diagram of the embodiment of the present application.
[0076] Figure 6 It is a process diagram of the fusible module of the embodiment of the present application gradually changing from multi-branch to single branch under the operation of fusion algorithms 1, 2, 3 and residual edge Dirac convolution. DETAILED DESCRIPTION
[0077] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the protection scope of the present application.
[0078] The present application provides an image classification network with a fusable multi-branch architecture. The network adopts a training mode of a multi-branch architecture during training, and fuses the multi-branch architecture into an equivalent single-branch architecture according to a corresponding fusion algorithm during inference, thereby accelerating the model inference speed without changing the accuracy. The present application mainly involves the following three parts:
[0079] (1) Overall architecture part
[0080] As shown in Figure 1 , it is a network overall architecture schematic diagram of the embodiment of the present application. Wherein, 1x, 2x, 4x and 8x represent the number of times of repeating the module. The present application mainly includes a head module, a transition module, a fusable module and a classification head module (the convolution module is not drawn in the figure). Figure 1
[0081] The overall working process of the present application is as follows:
[0082] 1) input image;
[0083] 2) the head module performs preliminary sampling on the input image;
[0084] 3) the transition module performs down-sampling and dimension expansion on the result of 2);
[0085] 4) the fusable module extracts features from the result of 3) and learns effective information;
[0086] 5) repeat the process of 3) and 4) until all the fusable modules are passed;
[0087] 6) the classification head module calculates the result of 5) to obtain the classification result (category information and category probability);
[0088] 7) output the classification result.
[0089] The size change of the input image through each module is shown in Table 1. In the table, the tuple (W, H, C) is used to represent the size of the image, wherein W represents the width of the image, H represents the height of the image, and C represents the number of channels of the image.
[0090] Table 1 Size change table
[0091]
[0092]
[0093] (2)Module part
[0094] 1)Standard convolution module
[0095] As shown in the convolution module schematic diagram of the embodiment of the application. Among them, only a has a BN layer, and the BN layers of b and c are absorbed by the convolution kernel. For details, please refer to fusion algorithm 2. Figure 2
[0096] The standard convolution module is composed of a standard convolution kernel with a step of 1, a batch normalization (Batch Normalization, BN) function and an activation function, as shown in a in the figure. Among them: Figure 2
[0097] The name of the standard convolution kernel is defined as The standard convolution expression can be written as:
[0098]
[0099] Among them, f( ) is the convolution kernel operation function, k is the convolution kernel size parameter, n is the convolution kernel serial number, w is the convolution kernel coefficient matrix, b is the convolution kernel bias coefficient, and x is the input.
[0100] The name of the BN is defined as BN n , and the expression can be written as:
[0101]
[0102] Among them, f( ) is the BN operation function, n is the BN serial number, γ is the BN weight coefficient, β is the BN bias coefficient, x is the input, μ is the mean of x, σ is the standard deviation of x, and ∈ is a constant ( ∈ = 10 -5 ).
[0103] The activation function is ReLU, and the name is defined as ReLU, and the expression can be written as:
[0104]
[0105] Among them, f( ) is the ReLU operation function, and x is the input.
[0106] The output of the single standard convolution module is:
[0107]
[0108] 2)Grouped convolution module
[0109] The grouped convolution module is composed of one grouped convolution kernel with a step of 1 and one ReLU function, as shown in b in the following formula: Figure 2 wherein:
[0110] The name of the grouped convolution kernel is defined as The expression of the grouped convolution can be written as:
[0111]
[0112] wherein, f() is a convolution kernel operation function, k is a convolution kernel size parameter, n is a convolution kernel serial number, w g is a convolution kernel coefficient matrix, b g is a convolution kernel bias coefficient, and x is an input.
[0113] The activation function is consistent with the standard convolution module, and thus will not be described again.
[0114] 3) Dirac convolution module
[0115] In order to fuse the residual edges in the basic module, the Dirac convolution module is proposed.
[0116] The Dirac convolution module is composed of one Dirac convolution kernel with a step of 1 and one identity function, as shown in c in the following formula: Figure 2 wherein:
[0117] The name of the Dirac convolution kernel is defined as The expression of the Dirac convolution can be written as:
[0118]
[0119] wherein, f() is a convolution kernel operation function, k is a convolution kernel size parameter, n is a convolution kernel serial number, w drac is a convolution kernel coefficient matrix, b drac is a convolution kernel bias coefficient, and x is an input.
[0120] The name of the activation function of the module is dracact, and the expression is:
[0121] f dracact (x) = 1, x ∈ R
[0122] wherein f dracact () is an operation function of the activation function, and x is an input.
[0123] In the application, the Dirac convolution kernel is a standard convolution kernel in a Dirac initialization manner, and the feature is that the center element of each convolution kernel is 1 in turn, and the other elements are all zero.
[0124] This module can convolve residual edges without changing the residual edge data, which facilitates subsequent integration with other convolutional modules.
[0125] 4) Header Module
[0126] like Figure 3 The diagram shown illustrates the modules in the network of this invention. A and b represent downsampling and dimensionality expansion, respectively. C is responsible for capturing multi-scale information, and d is responsible for converting the feature map into classification probabilities.
[0127] This module is as follows Figure 3 As shown in 'a', it consists of a standard convolutional kernel conv with a stride of 2. 3×3 It is composed of the ReLU function and serves to downsample.
[0128] 5) Transition module
[0129] This module has the same structure as the header module. For example... Figure 3 As shown in b, it consists of a standard convolutional kernel conv with a stride of 2. 3×3 It is composed of the ReLU function and serves to downsample.
[0130] 6) Basic modules (i.e., modules to be integrated)
[0131] like Figure 3 As shown in c, it has a two-layer structure. The first layer consists of a step size of 1. BN n The first layer consists of ReLU. The second layer comprises three standard convolutional modules with a stride of 1 and kernel sizes of 1×1, 3×3, and 5×5, respectively. The specific process is as follows:
[0132] a) Input x first passes through BN0 and ReLU are non-linearized, and the feature maps within the input x are simultaneously processed. Integration.
[0133] b) The results from the previous step will be subjected to multi-scale feature extraction to obtain more diverse information; and regularization and non-linearization will be performed through BN1, BN2, BN3 and ReLU functions;
[0134] c) The feature map obtained in the previous step will be spliced along the channel to form a new feature map, which will be added to the original input x (residual edge) to obtain the output y of this module.
[0135] 7) Classification Header Module
[0136] This module is as follows Figure 3As shown in d, it consists of a Global Average Pooling (GAP) layer and a Fully Connected (FC) layer, used for feature compression and class probability calculation.
[0137] (3) Fusion Algorithm Section
[0138] 1) Fusion Algorithm 1: Fusion of Convolutional Kernels
[0139] like Figure 4 The diagram shown is a schematic diagram of the convolution kernel filling process according to an embodiment of the present invention.
[0140] The fusion of any two convolutional kernels can be viewed as the fusion of the coefficient matrix w and the fusion of the bias coefficient b.
[0141] The overall idea of the algorithm is to first fill the multiple convolutional kernels to be merged to the same size, and then replace them with an equivalent grouped convolutional module.
[0142] For the padding part, firstly, the size of all the grouped convolutional kernels to be merged is counted, and the largest one is taken as the target. Then, zero padding is performed on the non-largest convolutional kernels until the size of the largest convolutional kernel is equal to that of the largest convolutional kernel.
[0143] The fused coefficient matrix w can be viewed as multiple convolution kernel coefficient matrices of the same size. n The expression for concatenating along the channel dimension can be written as:
[0144] w = {w1, w2, ..., w} n}
[0145] Where n is the convolution kernel number, w n It is the coefficient matrix of the nth convolution kernel.
[0146] The bias coefficient b is a one-dimensional vector, which is concatenated along its dimensional direction. Its expression is b. * It can be written as:
[0147] b = {b1, b2, ..., b} n}
[0148] Where n is the convolution kernel number, b n It is the bias coefficient of the nth convolution kernel.
[0149] The above expressions for w and b and grouped convolution kernels The expression forms are consistent. {w1, w2, ..., w} are spliced along the channel. n}conform to coefficient matrix w g Expression, and b symbol b g The biased expression. Therefore, a single grouped convolutional kernel can replace a multi-path convolutional kernel. If some of the convolutional kernels to be fused are grouped convolutional kernels, they can also be fused using the above method. In this case, the resulting grouped convolution is an asymmetric partitioned grouped convolutional kernel.
[0150] Based on the above calculations, the final result is... The input channel dimension of the fusion kernel is equal to the sum of the input channel dimensions of each convolutional kernel before fusion, and the output channel dimension is equal to the sum of the output channel dimensions of each convolutional kernel before fusion. Therefore, the channel dimensions of both input x and output y will double. In this case, slicing can be used to restore the dimensions of x and y to normal.
[0151] 2) Fusion Algorithm 2: Fusion of Convolutional Kernel and BN Layer
[0152] like Figure 5 The figure shown is a schematic diagram illustrating the effect of fusion algorithm 2 in an embodiment of the present invention.
[0153] For a standard convolutional module, its output y can be transformed into...
[0154]
[0155] The part of the expression where x > 0 can be used to create a new convolution kernel. The expression is:
[0156]
[0157] Where f() is the operation function, w * Let b be the weight coefficient matrix of the new convolution kernel. * is the bias coefficient of the new convolution kernel; the other parameters are as described above.
[0158] Through new convolution kernel This allows us to extract the components from the standard convolution kernel. and BN n They are merged into a new convolutional kernel, thereby accelerating inference speed. The specific process is as follows: Figure 5 As shown.
[0159] 3) Fusion Algorithm 3: Fusion of Activation Functions
[0160] This algorithm is applied when the activation functions of the convolutional modules to be fused are different. In this invention, it applies when Dirac convolutional modules and standard / grouped convolutional modules are fused.
[0161] To ensure that the outputs of the Dirac convolution module and the standard convolution module / grouped convolution module remain unchanged, this invention proposes the following activation function:
[0162]
[0163] where x res is the feature map of the residual edge. The function applies f ReLU to the part of the feature map that belongs to the residual edge and applies the identity mapping function f dracact to the non-residual part.
[0164] The specific implementation is as follows:
[0165] Step one, build a multi-branch architecture network including a head module containing a standard convolution module, an over module containing a standard convolution module, a fusible module, and a classification head module;
[0166] Step two, train and tune the multi-branch architecture network, and obtain the weight with the best performance;
[0167] Step three, based on the weight with the best performance, for the standard convolution module in the multi-branch architecture network, use fusion algorithm 2 to fuse the convolution kernels and BN n in all standard convolution modules into a convolution kernel Merge the two layers into one layer and "erase" all BN from the network;
[0168] Step four, perform the following operations on all fusible modules in the network:
[0169] As shown in Figure 6 , it is a process diagram of the fusible module of the embodiment of the application under the operation of fusion algorithms 1, 2, 3, and residual edge Dirac convolution.
[0170] 1) Use fusion algorithm 1 to fuse multiple standard convolutions and into a group convolution kernel gconv 5×5 with a group number of 3. At this time, the multiple standard convolutions and become a single group convolution gconv 5×5 ;
[0171] 2) On the basis of 1), process the residual edge thereof with two Dirac convolution modules, where the Dirac convolution kernel is dracconv 5×5 ; in this way, the feature map value of the residual edge can be ensured not to change, and the residual edge is convoluted, which is convenient for subsequent fusion;
[0172] 3) On the basis of 2), the convolution kernels and activation functions of the standard convolution module, the grouped convolution module and the Dirac convolution module located in the same layer are fused by using fusion algorithm 1 and fusion algorithm 3, at this time, the double-path convolution has become single-path convolution, and the residual edge is "absorbed";
[0173] Step five, output the final image classification network with a fusible multi-branch architecture.
[0174] The scheme provided by the application has the following effects:
[0175] The application first proposes an image classification network with a multi-branch architecture, and then proposes three fusion algorithms (fusion algorithm 1, 2 and 3) to fuse the multi-path convolution modules in the network into single-path convolution modules, thereby improving the network inference speed without affecting the accuracy. In summary, the application provides an accurate, efficient and practical method, which improves the inference efficiency of the multi-branch architecture network, and can provide a general method for real-time inference, such as automatic driving, automatic navigation, missile guidance, low-latency response equipment, etc.
[0176] Optionally, in some possible implementations, all or part of each of the above embodiments can be included.
[0177] It should be understood that, in the description of the specification, the description of the terms "one embodiment", "some embodiments", "example", "specific example" or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the application. In the description, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in any one or more embodiments or examples. In addition, the skilled in the art can combine and combine the different embodiments or examples described in the specification and the partial features of the different embodiments or examples without contradiction. The application.
[0178] Of course, those skilled in the art can make various corresponding changes and modifications according to the application without departing from the spirit and essence of the application, and these changes and modifications should all belong to the protection scope of the claims of the application.
Claims
1. A method for constructing an image classification network with a fusable multi-branch architecture, comprising: Comprise: Step one, build a multi-branch architecture network including a head module containing a standard convolution module, a transition module containing a standard convolution module, a fusable module, and a classification head module; Step two, train and parameterize the multi-branch architecture network, and obtain the optimal weight performance; Step three, based on the performance optimal weight, for the standard convolution module in the multi-branch architecture network, all the convolution kernels in the standard convolution module are fused into one convolution kernel by using fusion algorithm 2 and BN n into one convolution kernel merge two layers into one layer, and remove all BN from the network; Step four, perform the following operations on all fusable modules in the network: 1) using fusion algorithm 1, the multi-channel standard convolution and is filled into a group convolution kernel gconv with a group number of 3 5×5 , at this time the multi-channel standard convolution and becomes a single-channel group convolution gconv 5×5 ; 2) On the basis of 1), two Dirac convolution modules are used to process the residual edge, and the Dirac convolution kernel is dracconv 5×5 In this way, the feature map value of the residual edge can be ensured not to change, and the residual edge is convolved, which is convenient for subsequent fusion; 3) On the basis of 2), use fusion algorithm 1 and fusion algorithm 3 to fuse the convolution kernels and activation functions of the standard convolution module, the grouped convolution module and the Dirac convolution module located in the same layer at this time, the double-path convolution has become single-path convolution, and the residual edge is absorbed; Step five, output the final image classification network with a fusable multi-branch architecture.
2. The method for building an image classification network with a fusable multi-branch architecture according to claim 1, characterized in that: 1) The standard convolution module is composed of 1 standard convolution kernel with a step size of 1, 1 batch normalization function BN, and 1 activation function, wherein: The standard convolution kernel name definition is The standard convolution expression is: wherein f() is a convolution kernel operation function, k is the convolution kernel size parameter, n is the convolution kernel serial number, w is the convolution kernel coefficient matrix, b is the convolution kernel bias coefficient, and x is the input; The BN name definition is BN n The expression is: Wherein, f() is the BN operation function, n is the BN serial number, γ is the weight coefficient of BN, β is the bias coefficient of BN, x is the input, μ is the mean of x, σ is the standard deviation of x, ∈ is a constant (∈ = 10 -5 ) The activation function is ReLU, the name of which is defined as ReLU, and the expression can be written as: wherein f() is a ReLU operation function, and x is the input; The output of a single standard convolution module is: 2) Dirac convolution module The Dirac convolution module is composed of 1 Dirac convolution kernel with a step size of 1 and 1 identity function, wherein: The Dirac convolution kernel name definition is defined as The Dirac convolution expression is: wherein f() is a convolution kernel operation function, k is the convolution kernel size parameter, n is the convolution kernel serial number, w drac is a convolution kernel coefficient matrix, b drac is a convolution kernel bias coefficient, and x is an input. The activation function of this module is named dracact, and the expression is: f drracact (x) = 1, x e R; wherein f dracact () is an operation function of the activation function, and x is an input.
3. The method for building an image classification network with a fusable multi-branch architecture according to claim 2, characterized in that: 1) Head module The head module is composed of a standard convolution kernel conv^(3×3) with a step size of 2 and a ReLU function, which plays a role in downsampling; 2) Transition module The transition module is consistent with the head module in structure, which is composed of a standard convolution kernel conv^(3×3) with a step size of 2 and a ReLU function, which plays a role in downsampling; 3) Basic module The basic module has a two-layer structure, the first layer is composed of one step 1 BN n and ReLU, and the second layer is composed of three standard convolution modules with step 1, convolution kernel sizes of 1x1, 3x3 and 5x5 respectively; The specific process is as follows: a) input x first goes through BN0 and ReLU for nonlinearization, while each feature map within the input x will be fused; b) The results of step a) will be subjected to multi-scale feature extraction respectively to obtain more diverse information; and be regularized and nonlinearized through BN1, BN2, BN3 and ReLU function; c) The feature map obtained in step b) is spliced along the channel to form a new feature map, which is added to the original input x to obtain the output y of the basic module; 4) Classification head module The classification head module is composed of a global average pooling layer GAP and a fully connected layer FC, which is used for feature compression and class probability calculation.
4. The method of claim 3, wherein the method further comprises: Fusion algorithm 1 specifically includes: The fusion of any two convolution kernels is regarded as the fusion of the coefficient matrix w and the bias coefficient b. First, fill the multiple convolution kernels to be fused to the same size, and then replace them with an equivalent grouped convolution module. For the padding part, first count the size of all grouped convolution kernels to be fused, take the maximum as the target, and then pad the non-maximal convolution kernel to the size equal to the maximum convolution kernel; Wherein, the fused coefficient matrix w can be regarded as a plurality of convolution kernel coefficient matrices w of the same size n The expression along the channel dimension is spliced as: w = {w1, w2,..., w n} where n is the convolution kernel number, w n is the nth convolution kernel coefficient matrix; The bias coefficient b is a one-dimensional vector, to which concatenation is performed in the dimension direction thereof, and its expression b * is: b = {b1, b2,..., b n} where n is the convolution kernel number, b n is the nth convolution kernel bias coefficient; Expression of w and b and grouping convolution kernel Expression of w and b are consistent; {w1, w2,..., w n} along the channel splicing coefficient matrix w g Expression of b is consistent; therefore, replace the multi-path convolution kernel with a group convolution kernel; the final b g Expression of bias; therefore, replace the multi-path convolution kernel with a group convolution kernel; the final channel input dimension is equal to the sum of the channel input dimension of each convolution kernel before fusion, and the channel output dimension is equal to the sum of the channel output dimension of each convolution kernel before fusion; therefore, the channel dimension of its input x and output y will double, so the dimension of x and y is restored to normal by slicing.
5. The method of claim 4, wherein the method further comprises: Fusion algorithm 2 specifically includes: For the standard convolution module, the output y is deformed as: Wherein, the part of x>0 makes a new convolution kernel The expression is: wherein f() is an operation function, w * is a new convolution kernel weight coefficient matrix, b * is a new convolution kernel bias coefficient, and the remaining parameters are as shown previously. By new convolution kernel Put the standard convolution kernel in And BN n Fusion into a new convolution kernel.
6. The method of claim 5, wherein the method further comprises: Fusion algorithm 3 specifically includes: In order to ensure that the output of the Dirac convolution module and the standard convolution module and the grouped convolution module does not change, the activation function is: where x res is the feature map of the residual edge; the activation function applies to the part of the feature map belonging to the residual edge f ReLU , and applies the identity mapping function f dracact to the non-residual part.
Citation Information
Patent Citations
Convolutional neural network feature fusion algorithm based on feature screening and deep fusion
CN113837353A
Method for carrying out gesture recognition by using convolutional neural network based on distance perception and speed perception
CN117496550A