Target identification method and device, electronic equipment and storage medium

By introducing the residual structure and global transformation network into U-Net, combined with the attention module, the problems of vanishing gradients and poor recognition accuracy of U-Net in target recognition are solved, achieving higher network performance and recognition accuracy.

CN118570486APending Publication Date: 2024-08-30CHINA RONGTONG SCI RES INST GRP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410581616.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-11
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing U-Net has the problem of gradient disappearance and poor recognition accuracy in target recognition, mainly due to the disappearance of gradients caused by the increase in network depth and the loss of feature information caused by the expansion of local receptive fields.

Method used

The encoding network and decoding network with residual structure are used, combined with the global transformation network and attention module, to alleviate the vanishing gradient problem through residual connections and skip connections, and add global feature extraction to improve recognition accuracy.

Benefits of technology

It effectively improves network performance and target recognition accuracy, overcomes the problem of poor recognition accuracy, and significantly improves the accuracy of recognition results through the joint use of global features and local features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570486A
    Figure CN118570486A
Patent Text Reader

Abstract

The invention provides a target recognition method and device, electronic equipment and a storage medium. The method comprises the steps of determining a to-be-recognized image; inputting the to-be-recognized image into the target recognition model to obtain a target recognition result output by the target recognition model; the target recognition model is obtained by training based on a sample image and a sample recognition result thereof, the target recognition model comprises a coding network and a decoding network under a residual structure, and the coding network is used for extracting local image features and global image features of a to-be-recognized image; the decoding network is used for target recognition based on local image features and global image features, the problem of gradient disappearance caused by deepening of network layers in a traditional scheme is solved, the network performance is improved, meanwhile, a global feature extraction part is added in the image feature extraction process, and the image feature extraction efficiency is improved. The global image features and the local image features are used together for target recognition, the target recognition precision can be greatly improved, and the problem that the recognition precision is poor is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a target recognition method, device, electronic equipment and storage medium. Background Art

[0002] In view of the needs of target recognition, U-Net is currently widely used and has achieved good results. However, it still has some serious problems in target recognition. First, as the depth of the U-Net network increases, the gradient disappears. The parameters close to the output layer become the main learning parameters due to their large gradients, while the parameters far from the output layer can only be learned slowly at a very small rate due to their small gradients. In addition, in U-Net, the stacking of convolutional layers will make the network structure more complex, resulting in degradation problems and reducing the generalization performance of the network. Second, as a convolutional neural network model, U-Net uses the characteristic that convolution kernel extraction will multiply the receptive field, collects key feature information in the form of encoding and decoding, and then restores and identifies the target through layer-by-layer decoding. However, in the process of expanding the receptive field, some features will inevitably be ignored, resulting in poor target recognition accuracy. Summary of the invention

[0003] The present invention provides a target recognition method, device, electronic device and storage medium, which are used to solve the defects in the prior art that target recognition accuracy is not high, and the deepening of the network depth will cause the gradient to disappear, thereby reducing the generalization performance of the network, and achieve the improvement of network performance and target recognition accuracy.

[0004] The present invention provides a target recognition method, comprising:

[0005] Determine an image to be identified;

[0006] Inputting the image to be recognized into a target recognition model to obtain a target recognition result output by the target recognition model;

[0007] The target recognition model is trained based on sample images and their sample recognition results. The target recognition model includes an encoding network and a decoding network under a residual structure. The encoding network is used to extract local image features and global image features of the image to be recognized, and the decoding network is used to perform target recognition based on the local image features and the global image features.

[0008] According to a target recognition method provided by the present invention, the encoding network includes a local encoding network and a global conversion network;

[0009] The local encoding network includes a feature extraction layer and a linear mapping layer, wherein the feature extraction layer is used to extract local image features of the image to be identified, and the linear mapping layer is used to perform linear mapping on the local image features, and determine target image features based on the features obtained by the linear mapping and the target position features of the image to be identified;

[0010] The global transformation network is used to extract global features based on the target image features to obtain the global image features.

[0011] According to a target recognition method provided by the present invention, the global conversion network includes a plurality of global conversion layers connected in series, and each global conversion layer includes a multi-head self-attention module and a multi-layer perceptron module;

[0012] Among them, the features obtained by residual connection of the input features and output features of the multi-head self-attention module in each global conversion layer are used as the input features of the multi-layer perceptron module in the corresponding global conversion layer;

[0013] The features obtained by residually connecting the input features and output features of the multi-layer perceptron module in each global conversion layer serve as the input features of the multi-head self-attention module in the next global conversion layer of the corresponding global conversion layer.

[0014] According to a target recognition method provided by the present invention, the feature extraction layer of the encoding network includes a plurality of feature encoding modules connected in series, each feature encoding module includes a first encoding block and a second encoding block under a residual structure, the first encoding block and the second encoding block are used to convolve, normalize and activate input features, and the parameters of the first encoding block and the second encoding block are different;

[0015] The feature decoding layer of the decoding network includes a plurality of feature decoding modules connected in series, each feature decoding module includes a plurality of decoding blocks under a residual structure, and the decoding blocks are used to perform convolution, normalization and activation on the input features.

[0016] According to a target recognition method provided by the present invention, the decoding network further includes a feature fusion layer;

[0017] The feature fusion layer is used to perform bilinear interpolation on the output features of each feature decoding module, and to fuse multiple output features at the same resolution obtained by bilinear interpolation, and to perform target recognition based on the fused features.

[0018] According to a target recognition method provided by the present invention, the scales of the multiple feature encoding modules connected in series in the encoding network gradually decrease, and the scales of the multiple feature decoding modules connected in series in the decoding network gradually increase; each feature encoding module is jump-connected to the feature decoding module at the corresponding scale;

[0019] An attention module is provided at the jump connection of each feature decoding module in the decoding network, and each attention module is used to fuse the output features of the feature encoding module at the corresponding scale of the corresponding feature decoding module and the output features of the previous feature decoding module of the corresponding feature decoding module, and determine the input features of the corresponding feature decoding module based on the fused features.

[0020] According to a target recognition method provided by the present invention, each attention module is used to linearly transform the output features of the feature encoding module at the corresponding scale of the corresponding feature decoding module and the output features of the previous feature decoding module of the corresponding feature decoding module, and fuse the two output features at the same resolution obtained by the linear transformation to obtain the attention feature;

[0021] Each attention module is also used to perform a linear transformation on the attention feature and resample the transformed feature to obtain an attention coefficient, and determine the input feature of the corresponding feature decoding module based on the attention coefficient and the output feature of the feature encoding module at the corresponding scale of the corresponding feature decoding module.

[0022] The present invention also provides a target recognition device, comprising:

[0023] An image determination unit, used for determining an image to be identified;

[0024] A target recognition unit, used for inputting the image to be recognized into a target recognition model to obtain a target recognition result output by the target recognition model;

[0025] The target recognition model is trained based on sample images and their sample recognition results. The target recognition model includes an encoding network and a decoding network under a residual structure. The encoding network is used to extract local image features and global image features of the image to be recognized, and the decoding network is used to perform target recognition based on the local image features and the global image features.

[0026] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the target recognition method as described above is implemented.

[0027] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the target recognition method as described in any one of the above is implemented.

[0028] The target recognition method, device, electronic device and storage medium provided by the present invention perform target recognition on an image to be recognized through a target recognition model to obtain a target recognition result, wherein the target recognition model includes a coding network and a decoding network under a residual structure, the coding network is used to extract local image features and global image features of the image to be recognized, and the decoding network is used to perform target recognition based on local image features and global image features, which overcomes the problem of gradient disappearance caused by the deepening of the network layer in traditional solutions and improves network performance. At the same time, a global feature extraction part is added in the process of image feature extraction, and global image features are used together with local image features to perform target recognition, which can greatly improve the accuracy of target recognition and overcome the problem of poor recognition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0030] Figure 1 It is a flow chart of the target recognition method provided by the present invention;

[0031] Figure 2 It is a schematic diagram of the structure of the coding network provided by the present invention;

[0032] Figure 3 It is a structural schematic diagram of the feature extraction layer provided by the present invention;

[0033] Figure 4 is a schematic diagram of the structure of the global conversion layer provided by the present invention;

[0034] Figure 5 is a schematic diagram of the structure of the first coding block and the second coding block provided by the present invention;

[0035] Figure 6 It is a structural schematic diagram of the feature decoding module provided by the present invention;

[0036] Figure 7 It is the overall framework diagram of the target recognition model provided by the present invention;

[0037] Figure 8 It is a structural schematic diagram of the target recognition device provided by the present invention;

[0038] Fig. 9 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0040] U-Net, as a neural network model, is widely used in target recognition and has achieved good results, but it still has some serious problems:

[0041] First, as the network depth increases, the gradient vanishes. Parameters close to the output layer become the main learning parameters due to their large gradients, while parameters far from the output layer can only be learned slowly at a very small rate due to their small gradients. In addition, in U-Net, the stacking of convolutional layers will make the network structure deeper and more complex, resulting in degradation problems and reducing the generalization performance of the network.

[0042] Secondly, as a convolutional neural network model, it uses the characteristic that convolution kernel extraction will multiply the receptive field, collects key feature information through encoding and decoding, and then restores and identifies the target through layer-by-layer decoding. However, the convolution operation has a local receptive field and can only associate local areas. It has limitations in modeling long-distance dependencies. In other words, some information will inevitably be lost in the process of expanding the receptive field, resulting in poor accuracy of the final recognition result.

[0043] In this regard, the present invention provides a target recognition method, which aims to add a residual structure to the network, alleviate the gradient vanishing problem caused by the deepening of the network layer through residual connection, improve network performance, and increase the global feature extraction part. By extracting global image features and local image features, target recognition is performed together, which can greatly improve the accuracy of target recognition and overcome the current problem of poor recognition accuracy. Figure 1 It is a flow chart of the target recognition method provided by the present invention, such as Figure 1 As shown, the method includes:

[0044] Step 110, determining an image to be recognized;

[0045] Step 120, inputting the image to be recognized into the target recognition model to obtain the target recognition result output by the target recognition model;

[0046] The target recognition model is trained based on sample images and their sample recognition results. The target recognition model includes an encoding network and a decoding network under a residual structure. The encoding network is used to extract local image features and global image features of the image to be recognized, and the decoding network is used to perform target recognition based on local image features and global image features.

[0047] Specifically, before performing target recognition, it is first necessary to determine the image that needs to be recognized, that is, the image to be recognized. The image to be recognized here can be an image in various fields, such as human biological images, animal and plant images, etc., or it can be various types of images, such as landscape images, character images, and the embodiments of the present invention do not make specific limitations on this.

[0048] The image to be identified here can be one or more images. When there are multiple images to be identified, target recognition can be performed on each image to be identified to determine its corresponding target recognition result. It is worth noting that the target to be identified in each image to be identified can be one or more. When there are multiple targets to be identified, target recognition can be used to determine the type of each target and the position of the target, thereby determining the target recognition result of the entire image to be identified.

[0049] After the image to be identified is determined, target recognition can be performed on the image to be identified, so as to determine the type and position of each target to be identified therein, that is, to determine the target recognition result of the image to be identified. Here, specifically, the image to be identified can be input into a target recognition model, so that the target recognition model performs target recognition on the input image to be identified, so as to identify the type and position of each target to be identified therein, and finally the target recognition result corresponding to the image to be identified output by the target recognition model can be obtained.

[0050] Before inputting the image to be recognized into the target recognition model, the target recognition model can be pre-trained, that is, the sample image and the sample recognition results of the sample image can be applied to pre-train the target recognition model.

[0051] The training process of the target recognition model may include: first, collecting a large number of sample images, and marking the position and type of each target in the sample image, so as to form a sample recognition result of the sample image. Here, the image with the sample recognition result can also be used directly as training data, so as to avoid the tedious work of labeling; then, the sample image and its corresponding sample recognition result can be used to train the initial model to obtain the trained target recognition model. The initial model here can be built on the basis of the U-Net network.

[0052] However, although the traditional solution based on U-Net network has achieved some results in target recognition, it still has several serious problems. First, the gradient will disappear as the network depth increases. Second, the network has a local receptive field and can only associate local areas. It has limitations in long-distance modeling, which leads to the neglect of some features in the target recognition process, resulting in poor accuracy of the final recognition result.

[0053] In this regard, in an embodiment of the present invention, when performing target recognition based on a target recognition model, it is proposed that the structure of the target recognition model can be improved by adding a residual structure, so as to alleviate the problem of gradient vanishing caused by the increase in network depth through the residual connection in the residual structure, thereby improving the model performance, and adding a global feature extraction architecture to the encoder part of the U-Net network, for example, a Transformer architecture, to extract the global image features of the image to be recognized, so as to perform target recognition together with the local image features extracted by the original encoder, thereby obtaining accurate target recognition results, overcoming the problem of poor recognition accuracy.

[0054] That is, the target recognition model is composed of a codec network under a residual structure, and the codec network includes a coding network and a decoding network both of which adopt a residual structure. The network under the residual structure is characterized by being easy to optimize and being able to improve accuracy by increasing a considerable depth. Specifically in an embodiment of the present invention, a jump connection is used between the two networks inside the codec network under the residual structure, and a residual connection is used inside the coding network and the decoding network under the residual structure, and the problem of gradient disappearance can be well alleviated by these two.

[0055] Among them, the encoding network under the residual structure is used to extract the image features of the image to be identified, which specifically includes two parts, global image feature extraction and local image feature extraction. That is, the local image features of the image to be identified can be extracted through the encoder part of the U-Net network, and the global image features of the image to be identified can be extracted through the added global feature extraction architecture. The decoding network can decode according to the local image features and global image features extracted by the encoding network, and output the target recognition result of the image to be identified.

[0056] The target recognition method provided by the present invention performs target recognition on an image to be recognized through a target recognition model to obtain a target recognition result, wherein the target recognition model includes a coding network and a decoding network under a residual structure, the coding network is used to extract local image features and global image features of the image to be recognized, and the decoding network is used to perform target recognition based on local image features and global image features, which overcomes the problem of gradient disappearance caused by the deepening of network layers in traditional solutions and improves network performance. At the same time, a global feature extraction part is added in the process of image feature extraction, and global image features are used together with local image features to perform target recognition, which can greatly improve the accuracy of target recognition and overcome the problem of poor recognition accuracy.

[0057] Based on the above embodiment, the encoding network includes a local encoding network and a global conversion network;

[0058] The local coding network includes a feature extraction layer and a linear mapping layer, wherein the feature extraction layer is used to extract local image features of the image to be identified, and the linear mapping layer is used to perform linear mapping on the local image features, and determine the target image features based on the features obtained by the linear mapping and the target position features of the image to be identified;

[0059] The global transformation network is used to extract global features based on the target image features to obtain global image features.

[0060] Specifically, for the encoding network in the target recognition model, it can be divided into two parts from the level of image feature extraction, namely the local image feature extraction part and the global image feature extraction part. Since the local image features are extracted by the original encoder of the network, the local image feature extraction part can be called the local encoding network, and the global image features can be extracted based on the local image features, so the global feature extraction part can be called the global conversion network. In short, the encoding network under the residual structure includes the local encoding network and the global conversion network.

[0061] Figure 2 It is a schematic diagram of the structure of the coding network provided by the present invention, such as Figure 2 As shown, in order to make up for the defect of information loss in the target recognition process, that is, some features will be ignored, resulting in the problem of poor recognition accuracy, the Transformer architecture is introduced in the encoder part of the network in an embodiment of the present invention, that is, a hybrid encoder architecture of CNN (Convolutional Neural Networks) + Ttransformer is adopted as the encoding network of the model.

[0062] In the encoding network, CNN is first used as a feature extractor to extract features to obtain local image features, and the local image features are used as the input of the transformer after linear mapping to extract global image features through the transformer. That is, the local encoding network in the encoding network includes a feature extraction layer and a linear mapping layer, wherein the feature extraction layer is used to extract local image features of the image to be identified, and the linear mapping layer is used to perform linear mapping on the local image features, and determine the target image features based on the features obtained by the linear mapping and the target position features of the image to be identified; the global transformation network is used to perform global feature extraction based on the target image features to obtain global image features.

[0063] Figure 3 is a schematic diagram of the structure of the feature extraction layer provided by the present invention, such as Figure 3 As shown, the feature extraction layer includes four modules, namely BLOCK0, BLOCK1, BLOCK2 and BLOCK3, wherein BLOCK0 is used to preprocess the input image to be recognized; BLOCK1, BLOCK2 and BLOCK3 are used to extract features from the preprocessed image to obtain local image features.

[0064] Specifically, after the image to be recognized is input into the target recognition model, it will first enter BLOCK0, where it will pass through a CBR (Convolution+BatchNormalisation+ReLU) convolution block with a kernel size of 7x7 and 64 output channels, / 2 indicating that the kernel step is 2; then it will pass through the maximum pooling layer (MAXPOOL) with a kernel size of 3x3 and a step size of 2 to obtain the output result of the module. Here, the output dimension of BLOCK0 is (64, 56, 56), where 64 is the number of channels and the two 56s are height and width, respectively.

[0065] The output of BLOCK0 is used as the input of the subsequent BLOCK1. BLOCK1, BLOCK2 and BLOCK3 are all composed of Bottleneck (BTNK) with similar structures. BLOCK1, BLOCK2 and BLOCK3 contain 3, 4 and 6 BTNK respectively. Each BTNK is composed of multiple CBR convolution blocks. After BLOCK1, BLOCK2 and BLOCK3, the local image features of the image to be recognized can be obtained.

[0066] After obtaining the local image feature x output by the feature extraction layer, Where H×W (14×14) is the spatial resolution and C (1024) is the number of channels. First, it can be serialized to convert x into a series of 2D tiles, which can be expressed as The size of each tile is P×P, and the number of tiles is The tiles can then be encoded by linearly mapping them to transform the vectorized tiles x p Mapped to D-dimensional space, and in order to encode the spatial information of the block, the position information is also added, and finally the target image features output by the linear mapping layer can be obtained. This process can be specifically expressed as:

[0067]

[0068] in, is a linear mapping, is the positional encoding, both of which are trainable. In the linear mapping layer, x p After linear mapping, E is mapped to D-dimensional space to obtain a vector of size N×D, which is then compared with E pos The output of the linear mapping layer, i.e., the target image features, can be obtained by adding the encoded target position features.

[0069] This target image feature can be used as the input of the global transformation network in the encoding network, and the global transformation network can extract the global image feature based on this target image feature.

[0070] In the embodiment of the present invention, considering that the convolution operation of CNN has a local receptive field, it can only associate local areas and has limitations in modeling long-distance dependencies; and the transformer architecture used for sequence-to-sequence prediction has a global self-attention mechanism, but it is insufficient in the underlying details, which will lead to limited positioning capabilities. Based on this, it is proposed to introduce the transformer architecture in the encoder part of the U-Net network to cooperate with the encoder part for feature extraction, and obtain local detail features and global context feature extraction respectively. Based on this, the two are used together to perform target recognition, so as to restore the local spatial information through the decoding network to enhance the details, thereby obtaining accurate target recognition results, improving the accuracy of target recognition and model performance.

[0071] Based on the above embodiment, the global conversion network includes multiple global conversion layers connected in series, and each global conversion layer includes a multi-head self-attention module and a multi-layer perceptron module;

[0072] Among them, the features obtained by residual connection of the input features and output features of the multi-head self-attention module in each global conversion layer are used as the input features of the multi-layer perceptron module in the corresponding global conversion layer;

[0073] The features obtained by residually connecting the input features and output features of the multi-layer perceptron module in each global conversion layer serve as the input features of the multi-head self-attention module in the next global conversion layer of the corresponding global conversion layer.

[0074] Specifically, for the global conversion network in the encoding network, since it is constructed on the basis of the Transformer architecture, and the Transformer architecture includes a global self-attention mechanism, therefore, in an embodiment of the present invention, the global conversion network may include multiple global conversion layers connected in series, and each global conversion layer includes a multi-head self-attention module and a multi-layer perceptron module.

[0075] Figure 4 is a schematic diagram of the structure of the global conversion layer provided by the present invention, such as Figure 4 As shown in the figure, the global transformation layer (Transformer Layer) contains a multi-head self-attention module and a multi-layer perceptron module. Each multi-head self-attention module contains a LayerNorm (layer normalization) and MSA (Multi-Head Attention), and each multi-layer perceptron module contains a LayerNorm (layer normalization) and MLP (Multilayer Perceptron).

[0076] In the multi-head self-attention module, the input will pass through LayerNorm and MSA in sequence to obtain output, and this output will be residually connected with the input of the module, and the features obtained by the residual connection will be used as the input of the multi-layer perceptron module in the same global transformation layer; in the multi-layer perceptron module, its input will pass through LayerNorm and MLP in sequence to obtain output, and this output will be residually connected with the input of the module, and the features obtained by the residual connection will be used as the input of the multi-head self-attention module in the next global transformation layer, and this will be repeated until the last global transformation layer is entered.

[0077] That is, in each global conversion layer of the global conversion network, the features obtained by residually connecting the input features and output features of the multi-head self-attention module are used as the input features of the multi-layer perceptron module in the corresponding global conversion layer, and the features obtained by residually connecting the input features and output features of the multi-layer perceptron module are used as the input features of the multi-head self-attention module in the next global conversion layer.

[0078] Among them, the global conversion network contains L global conversion layers in total, and the output of the Lth global conversion layer can be expressed as:

[0079] z′ L =MSA(LN(z L-1 ))+z L-1

[0080] z L =MLP(LN(z′ L ))+z′ L

[0081] In the formula, z′ L is the output feature of the multi-head self-attention module in the Lth global conversion layer, LN is LayerNorm, z L-1 is the output feature of the L-1th global transformation layer, z L is the output feature of the Lth global transformation layer.

[0082] Specifically in the embodiment of the present invention, the global transformation network includes 6 Transformer Layers, and the output features of the last Transformer Layer are reshaped to transform the output features of the Transformer Layer with a dimension of N×D into This is the final output of the global conversion network. Then, the resolution of the features can be gradually increased from Convert to full resolution H×W to decode and output the target recognition result of the image to be recognized.

[0083] Based on the above embodiment, the feature extraction layer of the encoding network includes a plurality of feature encoding modules connected in series, each feature encoding module includes a first encoding block and a second encoding block under a residual structure, the first encoding block and the second encoding block are used to convolve, normalize and activate the input features, and the parameters of the first encoding block and the second encoding block are different;

[0084] The feature decoding layer of the decoding network includes multiple feature decoding modules connected in series. Each feature decoding module includes multiple decoding blocks under the residual structure. The decoding block is used to convolve, normalize and activate the input features.

[0085] Specifically, considering that the deep network U-Net updates the network parameters by gradient descent, the performance of the network will be improved as the network depth increases, but it will also bring about the problem of gradient disappearance. Gradient disappearance is caused by the multiplication characteristics of the chain rule, which makes the gradient of the network layer farther away from the output layer smaller, and the parameters close to the output layer become the main learning parameters of the network due to the large gradient, while the parameters far from the output layer can only be learned slowly at a very small rate due to the small gradient. In addition, the stacking of convolutional layers in the U-Net network will also make the network structure deeper and more complex, which will also cause degradation problems and reduce the generalization performance of the network. In this regard, a residual structure is proposed in an embodiment of the present invention, that is, a residual structure can be added to the convolutional blocks of the encoding network and the decoding network of the target recognition model, and a jump connection is performed through the residual structure directly in the network, and a residual connection is performed through the residual structure inside the network to alleviate the gradient disappearance problem caused by the increase in layers and improve the expression ability of the network.

[0086] It can be understood that the U-Net network is composed of a series of convolution blocks. In order to realize the residual structure in U-Net, the corresponding residual convolution blocks can be used to replace the original convolution blocks in the target recognition model formed on the basis of the U-Net network in an embodiment of the present invention. Specifically in the coding network, the residual structure can be introduced into BLOCK1, BLOCK2 and BLOCK3 in the feature extraction layer of the local coding network, specifically, the residual connection is introduced into the BTNK, and the multiple CBR convolution blocks therein are connected through the residual connection. And each BLOCK (BLOCK1, BLOCK2 and BLOCK3) includes two types of BTNK, namely the first coding block BTNK1 and the second coding block BTNK2, which respectively deal with the situations where the number of input and output channels is different and the same.

[0087] Specifically, in the local encoding network of the encoding network, the feature extraction layer includes a plurality of feature encoding modules connected in series, namely BLOCK1, BLOCK2 and BLOCK3, each feature encoding module includes a first encoding block and a second encoding block under a residual structure, namely BTNK1 and BTNK2, the parameters of the first encoding block and the second encoding block are different, that is, the number of channels of the input features and the output features corresponding to the first encoding block are different, and the number of channels of the input features and the output features corresponding to the second encoding block are the same; wherein, the first encoding block and the second encoding block are used to perform convolution, normalization and activation on the input features.

[0088] Figure 5 is a schematic diagram of the structure of the first coding block and the second coding block provided by the present invention, such as Figure 5 As shown in the figure, compared with BTNK2, BTNK1 has an additional 1x1 convolution layer to match the different number of input and output channels. The parameters of BTNK2 in BLOCK1, BLOCK2 and BLOCK3 are exactly the same except for the different input feature sizes. The parameters of BTNK1 in BLOCK1 are different from those of BTNK1 in BLOCK2 and BLOCK3. In BTNK1 in BLOCK1, the stride of the first convolution on the left path is 1, no downsampling is performed, and the input and output feature sizes are the same (see Figure 3 ); and the first 1x1 convolution on the left and right sides does not reduce the number of channels; while in BLOCK2 and BLOCK3, the stride of the first convolution on the left path is 2, and the first 1x1 convolution on the left and right sides reduces the number of channels. Figure 5 Where C and C1 are the number of channels, S is the stride, and W represents the size of the input / output features.

[0089] Correspondingly, in the decoding network of the target recognition model, its feature decoding layer includes multiple feature decoding modules connected in series, each feature decoding module includes multiple decoding blocks under the residual structure, and the decoding block is used to convolve, normalize and activate the input features.

[0090] Figure 6 is a schematic diagram of the structure of the feature decoding module provided by the present invention, such as Figure 6 As shown in the figure, for each feature decoding module, its input is the output feature of the feature encoding module at the same scale in the encoding network, which is fused with the output feature of the previous feature decoding module. This input will pass through two CBR convolution blocks (i.e., conv2d+BN+RELU). At the same time, a skip connection structure is added between the input and output, and its output is obtained through the residual connection, that is, the output feature of each feature decoding module.

[0091] Based on the above embodiment, the decoding network further includes a feature fusion layer;

[0092] The feature fusion layer is used to perform bilinear interpolation on the output features of each feature decoding module, and to fuse multiple output features at the same resolution obtained by bilinear interpolation, and to perform target recognition based on the fused features.

[0093] Specifically, for the global information of different scales received by the decoding network, since the features of each scale have different resolutions, they can be processed before being used for target recognition to upsample them to the same resolution and then fused. Finally, target recognition can be performed based on the fused features to obtain the final target recognition result.

[0094] Figure 7 It is the overall framework diagram of the target recognition model provided by the present invention, such as Figure 7 As shown in the figure, in the decoding network of the target recognition model, there is a feature fusion layer after the feature decoding layer. The feature fusion layer is used to perform bilinear interpolation (Bilinear upsample) on the output features of each feature decoding module to upsample them to the same resolution. Then, multiple output features at the same resolution can be spliced ​​to obtain the spliced ​​features. The features are passed through the convolutional layer conv to obtain the output Output of the target recognition model, which is the final target recognition result.

[0095] In an embodiment of the present invention, bilinear interpolation is performed on the output features of each feature decoding module through a feature fusion layer, and multiple output features at the same resolution obtained by bilinear interpolation are fused, so that target recognition is performed based on the fused features. Global information of different scales can be integrated for target recognition, which greatly improves the accuracy of target recognition, effectively solves the problem of target scale change, and effectively improves the performance of the target detection model.

[0096] Based on the above embodiment, the scales of the multiple feature encoding modules connected in series in the encoding network are gradually reduced, and the scales of the multiple feature decoding modules connected in series in the decoding network are gradually increased; each feature encoding module is jump-connected to the feature decoding module at the corresponding scale;

[0097] An attention module is provided at the jump connection of each feature decoding module in the decoding network. Each attention module is used to fuse the output features of the feature encoding module at the corresponding scale of the corresponding feature decoding module and the output features of the previous feature decoding module of the corresponding feature decoding module, and determine the input features of the corresponding feature decoding module based on the fused features.

[0098] Specifically, considering the U-Net network, in addition to the above-mentioned problem of gradient vanishing due to the deepening of the network layers, there is another problem, that is, the features from the encoder and decoder under the jump connection have a large semantic difference, which leads to poor accuracy of the final model prediction and affects the sensitivity and prediction accuracy of the model.

[0099] In view of this, in an embodiment of the present invention, an attention module is set in the decoding network of the target recognition model, so as to eliminate semantic ambiguity in the jump connection operation through the attention module, suppress irrelevant areas, and highlight the significant features of specific local areas. Specifically, different weights are assigned to each pixel, so that the relevant parts obtain higher weights and the parts with lower correlation obtain lower weights, thereby improving the recognition accuracy of the model.

[0100] Specifically, in an embodiment of the present invention, the feature extraction layer of the local encoding network in the encoding network includes a plurality of feature encoding modules connected in series, and the scale of each feature encoding module decreases in sequence according to the series connection, that is, the feature extraction layer includes a plurality of feature encoding modules connected in series and the scales of which gradually decrease; correspondingly, the feature decoding layer of the decoding network includes a plurality of feature decoding modules connected in series, and the scale of each feature decoding module increases in sequence according to the series connection, that is, the feature decoding layer includes a plurality of feature decoding modules connected in series and the scales of which gradually increase; and each feature encoding module is jump-connected to the feature decoding module at the corresponding scale.

[0101] Among them, an attention module is set at the jump connection of each feature decoding module in the decoding network. Each attention module has two inputs, namely the output features of the corresponding feature encoding module under the jump connection structure, and the output features of the previous feature decoding module of its corresponding feature decoding module; among them, the output features of the corresponding feature encoding module under the jump connection structure have richer contextual information because they come from a shallow network, and the output features of the previous feature decoding module have better feature representation because they come from a deeper network. The attention module can fuse the two and determine the input features of the corresponding feature decoding module based on the fused features.

[0102] That is, the attention module at the jump connection of each feature decoding module in the decoding network is used to fuse the output features of the feature encoding module under the jump connection structure of the corresponding feature decoding module (the output features of the feature encoding module at the corresponding scale of the corresponding feature decoding module) and the output features of the previous feature decoding module of the corresponding feature decoding module, and determine the input features of the corresponding feature decoding module based on the fused features.

[0103] In the embodiment of the present invention, the attention module can be used to fuse the features from the shallow network and the deep network, which can better integrate the local detail information and the global context information, so that the target recognition process can pay more attention to the relevant areas in the image to be recognized, while ignoring the irrelevant areas, thereby making the final recognition result more accurate and more precise. In addition, introducing the attention module into the target recognition model not only makes the prediction more accurate, but also reduces the computational overhead, and can also improve the sensitivity and prediction accuracy of the model.

[0104] Based on the above embodiment, each attention module is used to perform linear transformation on the output features of the feature encoding module at the corresponding scale of the corresponding feature decoding module and the output features of the previous feature decoding module of the corresponding feature decoding module, and fuse the two output features at the same resolution obtained by the linear transformation to obtain the attention feature;

[0105] Each attention module is also used to perform a linear transformation on the attention feature and resample the transformed feature to obtain an attention coefficient. Based on the attention coefficient and the output feature of the feature encoding module at the corresponding scale of the corresponding feature decoding module, the input feature of the corresponding feature decoding module is determined.

[0106] Specifically, each attention module can perform linear transformation on the feature x from the shallow network and the feature g from the deep network respectively, so that x is downsampled to the same resolution as g, thereby obtaining two output features after linear transformation, that is, two output features at the same resolution obtained by linear transformation; then the two output features can be fused, that is, the two are added together to make the aligned weight larger and the misaligned weight relatively smaller, thereby obtaining the attention feature.

[0107] After that, the attention feature can be linearly rectified by the ReLU activation function, and the feature obtained in this process is linearly transformed again to compress the number of channels of the feature to 1. The values ​​on it represent different weights. The feature is then passed through the sigmoid activation function to limit the value of the weight to between 0 and 1. The feature is then restored to the same size as x through a resampling operation. Here, the output of the sigmoid activation function can be resampled, specifically by trilinear interpolation to obtain an attention coefficient, which ranges from 0 to 1. The closer it is to 1, the more relevant the corresponding feature is. Finally, the input features of the corresponding feature decoding module can be determined based on the output features of the feature encoding module at the corresponding scale of the attention coefficient and the corresponding feature decoding module, that is, the attention coefficient is multiplied element by element with the features from the shallow network to obtain the input features of the corresponding feature decoding module. In this way, the output features of the shallow network are integrated, and they can be increased or decreased according to the correlation.

[0108] The target recognition device provided by the present invention is described below. The target recognition device described below and the target recognition method described above can be referenced to each other.

[0109] Figure 8 is a schematic diagram of the structure of the target recognition device provided by the present invention, such as Figure 8 As shown, the device comprises:

[0110] An image determination unit 810, configured to determine an image to be identified;

[0111] The target recognition unit 820 is used to input the image to be recognized into the target recognition model to obtain the target recognition result output by the target recognition model;

[0112] The target recognition model is trained based on sample images and their sample recognition results. The target recognition model includes an encoding network and a decoding network under a residual structure. The encoding network is used to extract local image features and global image features of the image to be recognized, and the decoding network is used to perform target recognition based on the local image features and the global image features.

[0113] The target recognition device provided by the present invention performs target recognition on an image to be recognized through a target recognition model to obtain a target recognition result, wherein the target recognition model includes a coding network and a decoding network under a residual structure, the coding network is used to extract local image features and global image features of the image to be recognized, and the decoding network is used to perform target recognition based on local image features and global image features, which overcomes the problem of gradient disappearance caused by the deepening of network layers in traditional solutions and improves network performance. At the same time, a global feature extraction part is added in the process of image feature extraction, and global image features are used together with local image features to perform target recognition, which can greatly improve the accuracy of target recognition and overcome the problem of poor recognition accuracy.

[0114] Based on the above embodiment, the encoding network includes a local encoding network and a global conversion network;

[0115] The local encoding network includes a feature extraction layer and a linear mapping layer, wherein the feature extraction layer is used to extract local image features of the image to be identified, and the linear mapping layer is used to perform linear mapping on the local image features, and determine target image features based on the features obtained by the linear mapping and the target position features of the image to be identified;

[0116] The global transformation network is used to extract global features based on the target image features to obtain the global image features.

[0117] Based on the above embodiment, the global conversion network includes a plurality of global conversion layers connected in series, and each global conversion layer includes a multi-head self-attention module and a multi-layer perceptron module;

[0118] Among them, the features obtained by residual connection of the input features and output features of the multi-head self-attention module in each global conversion layer are used as the input features of the multi-layer perceptron module in the corresponding global conversion layer;

[0119] The features obtained by residually connecting the input features and output features of the multi-layer perceptron module in each global conversion layer serve as the input features of the multi-head self-attention module in the next global conversion layer of the corresponding global conversion layer.

[0120] Based on the above embodiment, the feature extraction layer of the encoding network includes a plurality of feature encoding modules connected in series, each feature encoding module includes a first encoding block and a second encoding block under a residual structure, the first encoding block and the second encoding block are used to convolve, normalize and activate the input features, and the parameters of the first encoding block and the second encoding block are different;

[0121] The feature decoding layer of the decoding network includes a plurality of feature decoding modules connected in series, each feature decoding module includes a plurality of decoding blocks under a residual structure, and the decoding blocks are used to perform convolution, normalization and activation on the input features.

[0122] Based on the above embodiment, the decoding network further includes a feature fusion layer;

[0123] The feature fusion layer is used to perform bilinear interpolation on the output features of each feature decoding module, and to fuse multiple output features at the same resolution obtained by bilinear interpolation, and to perform target recognition based on the fused features.

[0124] Based on the above embodiment, the scales of the multiple feature encoding modules connected in series in the encoding network are gradually reduced, and the scales of the multiple feature decoding modules connected in series in the decoding network are gradually increased; each feature encoding module is jump-connected to the feature decoding module at the corresponding scale;

[0125] An attention module is provided at the jump connection of each feature decoding module in the decoding network, and each attention module is used to fuse the output features of the feature encoding module at the corresponding scale of the corresponding feature decoding module and the output features of the previous feature decoding module of the corresponding feature decoding module, and determine the input features of the corresponding feature decoding module based on the fused features.

[0126] Based on the above embodiment, each attention module is used to perform linear transformation on the output features of the feature encoding module at the corresponding scale of the corresponding feature decoding module and the output features of the previous feature decoding module of the corresponding feature decoding module, and fuse the two output features at the same resolution obtained by the linear transformation to obtain the attention feature;

[0127] Each attention module is also used to perform a linear transformation on the attention feature and resample the transformed feature to obtain an attention coefficient, and determine the input feature of the corresponding feature decoding module based on the attention coefficient and the output feature of the feature encoding module at the corresponding scale of the corresponding feature decoding module.

[0128] Fig. 9 An example of a physical structure diagram of an electronic device is shown in FIG. Fig. 9As shown, the electronic device may include: a processor 910, a communication interface 920, a memory 930 and a communication bus 940, wherein the processor 910, the communication interface 920 and the memory 930 communicate with each other through the communication bus 940. The processor 910 may call the logic instructions in the memory 930 to execute the target recognition method, which includes: determining an image to be recognized; inputting the image to be recognized into a target recognition model to obtain a target recognition result output by the target recognition model; the target recognition model is trained based on a sample image and its sample recognition result, and the target recognition model includes an encoding network and a decoding network under a residual structure, the encoding network is used to extract local image features and global image features of the image to be recognized, and the decoding network is used to perform target recognition based on the local image features and the global image features.

[0129] In addition, the logic instructions in the above-mentioned memory 930 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0130] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the target recognition method provided by the above-mentioned methods, and the method includes: determining an image to be recognized; inputting the image to be recognized into a target recognition model to obtain a target recognition result output by the target recognition model; the target recognition model is trained based on sample images and their sample recognition results, and the target recognition model includes an encoding network and a decoding network under a residual structure, the encoding network is used to extract local image features and global image features of the image to be recognized, and the decoding network is used to perform target recognition based on the local image features and the global image features.

[0131] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the target recognition method provided by the above-mentioned methods, the method comprising: determining an image to be recognized; inputting the image to be recognized into a target recognition model to obtain a target recognition result output by the target recognition model; the target recognition model is trained based on sample images and their sample recognition results, the target recognition model comprises an encoding network and a decoding network under a residual structure, the encoding network is used to extract local image features and global image features of the image to be recognized, and the decoding network is used to perform target recognition based on the local image features and the global image features.

[0132] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0133] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A target recognition method, characterized in that: include: Determine an image to be identified; Inputting the image to be recognized into a target recognition model to obtain a target recognition result output by the target recognition model; The target recognition model is trained based on sample images and their sample recognition results. The target recognition model includes an encoding network and a decoding network under a residual structure. The encoding network is used to extract local image features and global image features of the image to be recognized, and the decoding network is used to perform target recognition based on the local image features and the global image features.

2. The target recognition method according to claim 1, characterized in that: The encoding network includes a local encoding network and a global conversion network; The local encoding network includes a feature extraction layer and a linear mapping layer, wherein the feature extraction layer is used to extract local image features of the image to be identified, and the linear mapping layer is used to perform linear mapping on the local image features, and determine target image features based on the features obtained by the linear mapping and the target position features of the image to be identified; The global transformation network is used to extract global features based on the target image features to obtain the global image features.

3. The target recognition method according to claim 2, characterized in that: The global conversion network includes a plurality of global conversion layers connected in series, each of which includes a multi-head self-attention module and a multi-layer perceptron module; Among them, the features obtained by residual connection of the input features and output features of the multi-head self-attention module in each global conversion layer are used as the input features of the multi-layer perceptron module in the corresponding global conversion layer; The features obtained by residually connecting the input features and output features of the multi-layer perceptron module in each global conversion layer serve as the input features of the multi-head self-attention module in the next global conversion layer of the corresponding global conversion layer.

4. The target recognition method according to any one of claims 1 to 3, characterized in that: The feature extraction layer of the encoding network includes a plurality of feature encoding modules connected in series, each of which includes a first encoding block and a second encoding block under a residual structure, the first encoding block and the second encoding block are used to convolve, normalize and activate the input features, and the parameters of the first encoding block and the second encoding block are different; The feature decoding layer of the decoding network includes a plurality of feature decoding modules connected in series, each feature decoding module includes a plurality of decoding blocks under a residual structure, and the decoding blocks are used to perform convolution, normalization and activation on the input features.

5. The target recognition method according to claim 4, characterized in that: The decoding network also includes a feature fusion layer; The feature fusion layer is used to perform bilinear interpolation on the output features of each feature decoding module, and to fuse multiple output features at the same resolution obtained by bilinear interpolation, and to perform target recognition based on the fused features.

6. The target recognition method according to claim 4, characterized in that: The scales of the multiple feature encoding modules connected in series in the encoding network gradually decrease, and the scales of the multiple feature decoding modules connected in series in the decoding network gradually increase; each feature encoding module is jump-connected to a feature decoding module at a corresponding scale; An attention module is provided at the jump connection of each feature decoding module in the decoding network, and each attention module is used to fuse the output features of the feature encoding module at the corresponding scale of the corresponding feature decoding module and the output features of the previous feature decoding module of the corresponding feature decoding module, and determine the input features of the corresponding feature decoding module based on the fused features.

7. The target recognition method according to claim 6, characterized in that: Each attention module is used to perform linear transformation on the output features of the feature encoding module at the corresponding scale of the corresponding feature decoding module and the output features of the previous feature decoding module of the corresponding feature decoding module, and fuse the two output features at the same resolution obtained by the linear transformation to obtain the attention feature; Each attention module is also used to perform a linear transformation on the attention feature and resample the transformed feature to obtain an attention coefficient, and determine the input feature of the corresponding feature decoding module based on the attention coefficient and the output feature of the feature encoding module at the corresponding scale of the corresponding feature decoding module.

8. A target recognition device, characterized in that: include: An image determination unit, used for determining an image to be identified; A target recognition unit, used for inputting the image to be recognized into a target recognition model to obtain a target recognition result output by the target recognition model; The target recognition model is trained based on sample images and their sample recognition results. The target recognition model includes an encoding network and a decoding network under a residual structure. The encoding network is used to extract local image features and global image features of the image to be recognized, and the decoding network is used to perform target recognition based on the local image features and the global image features.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the target recognition method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the target recognition method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Remote sensing image target detection method based on fusion convolution attention mechanism

    CN116229295A

  • High-locking bolt detection system and method thereof

    CN117952976A