Target identification method and system, electronic equipment and storage medium
By building an object recognition model including encoder, decoder and detection head, using the self-attention mechanism and blocked reverse attention mechanism module, the existing small object detection algorithm is solved inadequate performance in complex backgrounds and noise environments, and high-precision and robust object detection effects are achieved.
Patent Information
- Application Number
- CN202411925172.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-12-25
AI Technical Summary
Existing small object detection algorithms are not effective when processing complex background information and images with high local noise, making it difficult to achieve high-precision and robust detection.
Build a target recognition model, including encoder, decoder and detection head, use convolutional layers and self-attention mechanism to acquire image features, improve feature extraction capabilities through progressive fusion and feature enhancement operations, and realize the fusion of deep and shallow features through blocked reverse attention mechanism module.
The performance of small object detection algorithm in complex background and noise environments is improved, the accuracy and robustness of target feature extraction is enhanced, and detailed information near object boundaries can be better captured.
Smart Images

Figure CN119785007A_ABST
Abstract
Description
Background Art
[0002] In the real world, image data is widely used in almost all fields. In these applications, certain technologies are usually required to detect and determine the most visually meaningful target data. Multimodal document images contain a large amount of unstructured information, such as text, tables, and images, which are often used to store key business data. Multimodal document images usually contain multiple small targets, which usually represent key information such as equipment names, technical parameters, prices, etc. Although they are small in size, their information value is extremely high. By extracting these targets, it is possible to quickly lock on to the key content in the document and avoid missing key details. The small targets here have the following characteristics:
[0003] 1) Scattered distribution and high diversity: Small targets usually include contract terms, equipment models, parameter tables, etc. This information is distributed in different areas of the document image and is diverse. Small targets may be presented in the form of text, charts or images, and their position and layout are not fixed, which increases the complexity of extraction.
[0004] 2) Interweaving of text and image information: Small objects in bidding documents are often embedded in complex text and image backgrounds, such as numerical values in tables, technical parameters with accompanying instructions, or annotations in schematic diagrams. This multimodal feature requires algorithms to be able to integrate text semantics and visual information.
[0005] 3) Low criticality and error tolerance: Small targets such as price, specification parameters or construction period clauses are often directly related to the bidding results and are extremely important. At the same time, misreading or omission can lead to major decision-making errors, so high-precision and robust detection algorithms are needed. At present, many small target detection algorithms based on traditional image processing technology, machine learning technology and deep learning technology have been proposed and applied. The existing small target detection algorithms can detect small targets in some simple scene images very well. However, when there is complex background information in the image, or the local noise of the small target is large, it is difficult for the existing small target detection algorithms to make good predictions. Therefore, how to improve the performance and application effect of small target detection algorithms is still a hot topic and difficulty in current research in this field.
[0006] Small target detection not only requires special attention to small targets in the image, but also should be combined with relevant feature information such as background and noise in the image. The currently popular methods for extracting image feature information include convolutional neural networks, generative adversarial networks, and graph convolutional neural networks. These different feature extraction methods have their own advantages in feature extraction, but each algorithm also has great shortcomings. For example, the CNN-based deep learning method is not effective in segmenting small targets and lacks clear contours and texture features; the filter-based method is difficult to achieve significant results in complex scenes. Complex background information, noise interference, and small size of small targets are the characteristics of small target images, which also brings certain challenges to the current small target detection. Summary of the invention
[0007] The technical problem to be solved by the present invention is to address the deficiencies of the prior art and specifically provide a target recognition method, system, electronic device and storage medium, as follows:
[0008] 1) In the first aspect, the present invention provides a target recognition method, and the specific technical solution is as follows:
[0009] Construct a target recognition model, which includes an encoder, a decoder and a detection head. The encoder is used to obtain the image features of the sample image at different stages by using the convolution layer and the self-attention mechanism. The decoder is used to gradually fuse the image features of the sample image at different stages, assign different weights to the final fused image features, and then perform feature enhancement operations to obtain the enhanced final fused image features. The detection head is used to process the enhanced final fused image features to obtain the target recognition result of the sample image.
[0010] Train the target recognition model to obtain a trained target recognition model;
[0011] The trained target recognition model is used to recognize the preset image to obtain the target recognition result of the preset image.
[0012] Based on the above solution, a target recognition method of the present invention can also be improved as follows.
[0013] Further, the encoder includes a first convolutional layer, a first self-attention mechanism module, a second self-attention mechanism module and a third self-attention mechanism module arranged in sequence; the first self-attention mechanism module, the second self-attention mechanism module and the third self-attention mechanism module are used to process each received data through the self-attention mechanism;
[0014] Use the output of the first convolutional layer as the input of the first self-attention mechanism module;
[0015] Use the output of the first self-attention mechanism module as the input of the second self-attention mechanism module;
[0016] The output of the second self-attention mechanism module is used as the input of the third self-attention mechanism module;
[0017] The image features of the sample image at different stages include: the output of the first convolutional layer, the output of the first self-attention mechanism module, the output of the second self-attention mechanism module, and the output of the third self-attention mechanism module.
[0018] Further, the decoder includes a first dilated convolution layer, a first block reverse attention mechanism module, a second dilated convolution layer, a second block reverse attention mechanism module, a second convolution layer, a third block reverse attention mechanism module, a third convolution layer, a fourth block reverse attention mechanism module, a compactness measurement module and a feature enhancement module, which are arranged in sequence;
[0019] Use the output of the third self-attention mechanism module as the input of the first dilated convolutional layer;
[0020] The output of the first convolutional layer is also used as the input of the fourth block reverse attention mechanism module;
[0021] The output of the first self-attention mechanism module is also used as the input of the third block reverse attention mechanism module;
[0022] The output of the second self-attention mechanism module is also used as the input of the second block reverse attention mechanism module;
[0023] The output of the third self-attention mechanism module is used as the input of the first dilated convolutional layer and as the input of the first block reverse attention mechanism module;
[0024] The output of the first dilated convolutional layer is used as the input of the first block-wise reverse attention mechanism module;
[0025] The output of the first block reverse attention mechanism module is used as the input of the second dilated convolutional layer;
[0026] The output of the second dilated convolutional layer is used as the input of the second block-wise reverse attention mechanism module;
[0027] The output of the second block reverse attention mechanism module is used as the input of the second convolutional layer;
[0028] The output of the second convolutional layer is used as the input of the third block reverse attention mechanism module;
[0029] The output of the third block reverse attention mechanism module is used as the input of the third convolutional layer;
[0030] The output of the third convolutional layer is used as the input of the fourth block reverse attention mechanism module;
[0031] The first block reverse attention mechanism module, the second block reverse attention mechanism module, the third block reverse attention mechanism module and the fourth block reverse attention mechanism module are used to perform feature fusion on the data received respectively;
[0032] The output of the fourth block reverse attention mechanism module is the final fused image feature, which is input into the compactness measurement module. The compactness measurement module assigns different weights to the final fused image feature, and then the feature enhancement operation is performed by the feature enhancement module to obtain the enhanced final fused image feature.
[0033] 2) In the second aspect, the present invention also provides a target recognition system, and the specific technical solution is as follows:
[0034] It includes model building module, model training module and target recognition module;
[0035] The model building module is used to build a target recognition model. The target recognition model includes an encoder, a decoder and a detection head. The encoder is used to obtain the image features of the sample image at different stages by using the convolution layer and the self-attention mechanism. The decoder is used to gradually fuse the image features of the sample image at different stages, assign different weights to the final fused image features, and then perform feature enhancement operations to obtain the enhanced final fused image features. The detection head is used to process the enhanced final fused image features to obtain the target recognition result of the sample image.
[0036] The model training module is used to: train the target recognition model to obtain a trained target recognition model;
[0037] The target recognition module is used to: use the trained target recognition model to recognize the preset image and obtain the target recognition result of the preset image.
[0038] Based on the above solution, a target recognition system of the present invention can also be improved as follows.
[0039] Furthermore, the decoder is specifically used to: utilize the dilated convolution layer, the block reverse attention mechanism module and the convolution layer to progressively fuse the image features of the sample image at different stages, assign different weights to the final fused image features, and then perform feature enhancement operations to obtain the enhanced final fused image features.
[0040] Further, the encoder includes a first convolutional layer, a first self-attention mechanism module, a second self-attention mechanism module and a third self-attention mechanism module arranged in sequence; the first self-attention mechanism module, the second self-attention mechanism module and the third self-attention mechanism module are used to process each received data through the self-attention mechanism;
[0041] Use the output of the first convolutional layer as the input of the first self-attention mechanism module;
[0042] The output of the first self-attention mechanism module is used as the input of the second self-attention mechanism module;
[0043] The output of the second self-attention mechanism module is used as the input of the third self-attention mechanism module;
[0044] The image features of the sample image at different stages include: the output of the first convolutional layer, the output of the first self-attention mechanism module, the output of the second self-attention mechanism module, and the output of the third self-attention mechanism module.
[0045] Further, the decoder includes a first dilated convolution layer, a first block reverse attention mechanism module, a second dilated convolution layer, a second block reverse attention mechanism module, a second convolution layer, a third block reverse attention mechanism module, a third convolution layer, a fourth block reverse attention mechanism module, a compactness measurement module and a feature enhancement module, which are arranged in sequence;
[0046] Use the output of the third self-attention mechanism module as the input of the first dilated convolutional layer;
[0047] The output of the first convolutional layer is also used as the input of the fourth block reverse attention mechanism module;
[0048] The output of the first self-attention mechanism module is also used as the input of the third block reverse attention mechanism module;
[0049] The output of the second self-attention mechanism module is also used as the input of the second block reverse attention mechanism module;
[0050] The output of the third self-attention mechanism module is used as the input of the first dilated convolutional layer and as the input of the first block reverse attention mechanism module;
[0051] The output of the first dilated convolutional layer is used as the input of the first block-wise reverse attention mechanism module;
[0052] The output of the first block reverse attention mechanism module is used as the input of the second dilated convolutional layer;
[0053] The output of the second dilated convolutional layer is used as the input of the second block-wise reverse attention mechanism module;
[0054] The output of the second block reverse attention mechanism module is used as the input of the second convolutional layer;
[0055] The output of the second convolutional layer is used as the input of the third block reverse attention mechanism module;
[0056] The output of the third block reverse attention mechanism module is used as the input of the third convolutional layer;
[0057] The output of the third convolutional layer is used as the input of the fourth block reverse attention mechanism module;
[0058] The first block reverse attention mechanism module, the second block reverse attention mechanism module, the third block reverse attention mechanism module and the fourth block reverse attention mechanism module are used to perform feature fusion on the data received respectively;
[0059] The output of the fourth block reverse attention mechanism module is the final fused image feature, which is input into the compactness measurement module. The compactness measurement module assigns different weights to the final fused image feature, and then the feature enhancement operation is performed by the feature enhancement module to obtain the enhanced final fused image feature.
[0060] 3) In a third aspect, the present invention further provides an electronic device, comprising a processor, the processor being coupled to a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor so that the electronic device implements any of the above-mentioned target recognition methods.
[0061] 4) In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, any of the above-mentioned target recognition methods is implemented.
[0062] The beneficial effects of the present invention are as follows:
[0063] The encoder-decoder structure constructed by the present invention, i.e., the target recognition model, can enhance the target features and suppress noise on the one hand, and refine the deep features through the dilated convolution and feature enhancement module on the other hand. The present invention jumps the encoder (shallow features) and the decoder (deep features), which can realize the fusion of deep and shallow features, so as to better extract the deep semantic features of the image. We innovatively introduce block attention into the jump connection between the encoder and the decoder, combined with the characteristics of the target in the target image being point-shaped in the image, by blocking the core image containing the target in the deep features and processing it through the reverse attention mechanism, we can find and supplement the target-related detail information missing in the shallow layer, and capture the residual details near the boundary of the object well. A large number of comprehensive experiments conducted on different challenging data sets can verify that the model provided by the present invention can not only make good predictions for conventional target images, but also for images in situations such as targets with complex background information. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments of the present invention:
[0065] Figure 1 A schematic diagram of a target recognition method according to an embodiment of the present invention;
[0066] Figure 2 This is a schematic diagram of the network structure of the target recognition model;
[0067] Figure 3 This is a schematic diagram of the network structure of the block reverse attention mechanism module;
[0068] Figure 4 This is a schematic diagram of the introduction to the international standard data set;
[0069] Figure 5 A schematic diagram of the RIPT model, PSTNN model, ACM model, AGPCNet model, DNANet model, RKFormer model and ISNet model;
[0070] Figure 6 A brief diagram of IoU, nIoU and F1-score;
[0071] Figure 7 This is a schematic diagram of the comparison data of the detection results of the trained model;
[0072] Figure 8 A schematic diagram of the structure of a target recognition system according to an embodiment of the present invention;
[0073] Fig. 9The figure is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0074] The principles and features of the present invention are described below. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.
[0075] The technical solution of the present invention and how the technical solution of the present invention solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.
[0076] like Figure 1 As shown, a target recognition method according to an embodiment of the present invention comprises the following steps:
[0077] S1. Construct a target recognition model, which includes an encoder, a decoder and a detection head. The encoder is used to obtain the image features of the sample image at different stages by using the convolution layer and the self-attention mechanism. The decoder is used to gradually fuse the image features of the sample image at different stages, assign different weights to the final fused image features, and then perform feature enhancement operations to obtain the enhanced final fused image features. The detection head is used to process the enhanced final fused image features to obtain the target recognition result of the sample image.
[0078] S2, training the target recognition model to obtain a trained target recognition model;
[0079] S3. Use the trained target recognition model to recognize the preset image to obtain the target recognition result of the preset image.
[0080] Among them, in the context of the digital transformation of the power industry, the traditional way of processing bidding documents faces the problems of low efficiency, easy errors, and difficulty in scalability. In particular, the multimodal small targets involved in the documents (such as equipment names, technical parameters, quotation information, construction drawings, etc.) are complex in distribution and small in size. Manually extracting this information is time-consuming and easy to miss. Multiple sample images are determined from multiple bidding documents. For example, each page of the image in the bidding document is used as a sample image, and the multimodal small targets in the sample image (multimodal small targets include equipment names, technical parameters, quotation information, and construction drawings, etc.) are annotated. Then, the target recognition model is trained using multiple annotated sample images to obtain a trained target recognition model.
[0081] Taking the image of each page in the specified bidding document as the target image, the trained target recognition model can comprehensively analyze the text, image and layout features, and accurately and efficiently extract the key information in the specified bidding document. The key information is the target recognition result. The targets in the target recognition result may include equipment name, technical parameters, quotation information, construction drawings, etc.
[0082] Among them, the target image can also be a road image specified by the user, and the targets in the road image are cars, electric vehicles, bicycles and pedestrians, etc. It should be noted that in order to identify different targets, the labeled sample images constructed for the training target recognition model are different.
[0083] Optionally, in the above technical solution, the decoder is specifically used to: use the dilated convolution layer, the block reverse attention mechanism module and the convolution layer to progressively fuse the image features of the sample image at different stages, assign different weights to the final fused image features, and then perform feature enhancement operations to obtain the enhanced final fused image features.
[0084] Optionally, in the above technical solution, if Figure 2 As shown, the encoder includes a first convolutional layer, a first self-attention mechanism module, a second self-attention mechanism module and a third self-attention mechanism module which are arranged in sequence; the first self-attention mechanism module, the second self-attention mechanism module and the third self-attention mechanism module are used to process each received data through the self-attention mechanism;
[0085] Use the output of the first convolutional layer as the input of the first self-attention mechanism module;
[0086] Use the output of the first self-attention mechanism module as the input of the second self-attention mechanism module;
[0087] The output of the second self-attention mechanism module is used as the input of the third self-attention mechanism module;
[0088] The image features of the sample image at different stages include: the output of the first convolutional layer, the output of the first self-attention mechanism module, the output of the second self-attention mechanism module, and the output of the third self-attention mechanism module.
[0089] Optionally, in the above technical solution, if Figure 2 As shown, the decoder includes a first dilated convolution layer, a first block reverse attention mechanism module, a second dilated convolution layer, a second block reverse attention mechanism module, a second convolution layer, a third block reverse attention mechanism module, a third convolution layer, a fourth block reverse attention mechanism module, a compactness measurement module and a feature enhancement module, which are arranged in sequence;
[0090] Figure 2In the figure, “R1” represents the first block reverse attention mechanism module, “R2” represents the second block reverse attention mechanism module, “R3” represents the third block reverse attention mechanism module, and “R4” represents the fourth block reverse attention mechanism module.
[0091] Use the output of the third self-attention mechanism module as the input of the first dilated convolutional layer;
[0092] The output of the first convolutional layer is also used as the input of the fourth block reverse attention mechanism module;
[0093] The output of the first self-attention mechanism module is also used as the input of the third block reverse attention mechanism module;
[0094] The output of the second self-attention mechanism module is also used as the input of the second block reverse attention mechanism module;
[0095] The output of the third self-attention mechanism module is used as the input of the first dilated convolutional layer and as the input of the first block reverse attention mechanism module;
[0096] The output of the first dilated convolutional layer is used as the input of the first block-wise reverse attention mechanism module;
[0097] The output of the first block reverse attention mechanism module is used as the input of the second dilated convolutional layer;
[0098] The output of the second dilated convolutional layer is used as the input of the second block-wise reverse attention mechanism module;
[0099] The output of the second block reverse attention mechanism module is used as the input of the second convolutional layer;
[0100] The output of the second convolutional layer is used as the input of the third block reverse attention mechanism module;
[0101] The output of the third block reverse attention mechanism module is used as the input of the third convolutional layer;
[0102] The output of the third convolutional layer is used as the input of the fourth block reverse attention mechanism module;
[0103] The first block reverse attention mechanism module, the second block reverse attention mechanism module, the third block reverse attention mechanism module and the fourth block reverse attention mechanism module are used to perform feature fusion on the data received respectively;
[0104] The output of the fourth block reverse attention mechanism module is the final fused image feature, which is input into the compactness measurement module. The compactness measurement module assigns different weights to the final fused image feature, and then the feature enhancement operation is performed by the feature enhancement module to obtain the enhanced final fused image feature.
[0105] Among them, the data processing process of each self-attention mechanism module is as follows:
[0106] S11, the self-attention mechanism module uses two point-by-point convolution layers (respectively denoted as the first point-by-point convolution layer and the second point-by-point convolution layer) to process the received features to obtain the first intermediate feature map and the second intermediate feature map. The received feature is I, I∈R {H′×W′×C′} , the first intermediate feature map is I 1 , I 1 ∈R {H″×W″×1} , the second intermediate feature map is I 2 , I 2 ∈R {H″′×W″′×1} , I 1 =PW 1 (I),I 2 =PW 2 (I), PW 1 (I) means: point-by-point convolution operation is performed on I through the first point-by-point convolution layer, PW 2 (I) means: I is subjected to a point-by-point convolution operation through the second point-by-point convolution layer.
[0107] Among them, the feature received by the first self-attention mechanism module is: the output of the first convolutional layer, at this time, C ′ =C, The feature received by the second self-attention mechanism module is: the output of the first self-attention mechanism module. At this time, C ′ =2C, The feature received by the third self-attention mechanism module is: the output of the second self-attention mechanism module. At this time, C ′ =4C, H is the height of the sample image, W is the width of the sample image, and C is the preset number of channels. The preset number of channels can be 16 or 64, etc., and can be set according to actual conditions.
[0108] Among them, in the process of training the target recognition model, the parameters of the two point-by-point convolutional layers used by the self-attention mechanism module are different, so I 1 with I 2 It must be different, H ′ =H ″ =H ″′ , W ′ =W ″ =W ″′ .
[0109] S12, for the first intermediate feature map I 1and the second intermediate feature map I 2 Perform a reshape operation, and then obtain the first intermediate feature map I after reshape through the fully connected layer 1 The attention feature input q and the reshaped second intermediate feature map I 2 The attention feature input k is implemented by the following formula:
[0110] q=FC(reshape(I 1 ))
[0111] k=FC(reshape(I 2 ))
[0112] Where q∈R {H′×1} , k∈R {1×H′} ,reshape(I 1 ) means: for the first intermediate feature map I 1 Perform reshape operation, FC(reshape(I 1 )) means: the first intermediate feature map I after shape reshaping is obtained through the fully connected layer 1 The attention feature input q, reshape(I 2 ) means: for the second intermediate feature map I 2 Perform reshape operation, FC(reshape(I 2 )) means: the second intermediate feature map I after shape reshaping is obtained through the fully connected layer 2 The attention feature input k.
[0113] S13, reshaping the first intermediate feature map I 1 The attention feature input q and the reshaped second intermediate feature map I 2 The attention feature input k is matrix multiplied, and after point-by-point convolution and softmax operation, the attention matrix attention is obtained:
[0114] attention = softmax(PW(q×k))
[0115] Among them, attention∈R {H′×H′×C′} , q×k represents: the first intermediate feature map I after reshaping 1 The attention feature input q and the reshaped second intermediate feature map I 2 The attention feature input k is matrix multiplied, PW(q×k) means: point-by-point convolution operation is performed on q×k through the point-by-point convolution layer, and softmax(PW(q×k)) means: softmax operation is performed on PW(q×k).
[0116] S14, process the received feature I through the convolution layer to calculate the convolution feature I conv :
[0117] I conv =Conv(I)
[0118] Among them, I conv ∈R {H′×W′×C′} , Conv(I) means: performing a convolution operation on the received feature I through the convolution layer.
[0119] S15. Combine the attention matrix attention and the convolution feature I conv Multiply each channel to get the attention output feature O attention :
[0120] O attention =attention×I conv
[0121] Among them, O attention ∈R {H′×W′×C′} .
[0122]
[0123] S16, finally, the received feature I, convolution feature I conv and the attention output feature O attention Perform feature fusion to obtain the fused features
[0124]
[0125] Among them, α represents the coefficient,
[0126] S17. Based on the fused features Get the final output feature O:
[0127]
[0128] in, Representation: Use the convolutional layer to fused features Perform convolution operation, Representation: The fused features are obtained through point-by-point convolutional layers Perform point-by-point convolution operations. Indicates: Yes and Add.
[0129] Traverse the features received by the first self-attention mechanism module, the features received by the second self-attention mechanism module, and the features received by the third self-attention mechanism module to obtain the output of the first self-attention mechanism module, the output of the second self-attention mechanism module, and the output of the third self-attention mechanism module.
[0130] The attention matrix attention can effectively perceive the location of the target after continuous optimization and learning. Stacking three self-attention mechanism modules layer by layer can effectively enhance the characteristics of the target and suppress noise, and can solve the problem of target loss during downsampling.
[0131] Among them, the block reverse attention mechanism module is an important module connecting the encoder and decoder. This module enhances and supplements the loss of target information caused by the deep network by fusing the output of the previous layer with the shallow block features. The data processing process of the block reverse attention mechanism module is as follows: first, the deep features are upsampled to be consistent with the shallow feature space dimension, the input target image is divided into blocks through the ResNet34 model and the fully connected layer, and the generated image is passed through the Sigmoid activation function. The feature map is subtracted from the all-one vector to obtain the block reverse attention weight, and the weight is applied to the shallow features to fuse the deep features, and then the feature map of this stage is obtained through convolution operation and residual connection, such as Figure 3 As shown, specifically:
[0132] S20: Perform an upsampling operation on the channel dimension of the output feature map out of the previous layer to achieve a feature Out with the same number of channels as the shallow feature. upsample :
[0133] Out upsample =Upsample(out)
[0134] Among them, Upsample(out) means Out upsample The upsampling operation is performed. Among them, the previous output feature map of the first block reverse attention mechanism module is: the output of the first dilated convolutional layer, the previous output feature map of the second block reverse attention mechanism module is: the output of the second dilated convolutional layer, the previous output feature map of the third block reverse attention mechanism module is: the output of the second convolutional layer, and the previous output feature map of the fourth block reverse attention mechanism module is: the output of the third convolutional layer.
[0135] Among them, since the first block reverse attention mechanism module needs to be processed in combination with the output (shallow features) of the third self-attention mechanism module, the output feature map of the previous layer of the first block reverse attention mechanism module is upsampled in the channel dimension, and the number of channels is the same as the output of the third self-attention mechanism module; since the second block reverse attention mechanism module needs to be processed in combination with the output (shallow features) of the second self-attention mechanism module, the output feature map of the previous layer of the second block reverse attention mechanism module is upsampled in the channel dimension, and the number of channels is the same as the output of the second self-attention mechanism module; since the third block reverse attention mechanism module needs to be processed in combination with the output (shallow features) of the first self-attention mechanism module, the output feature map of the previous layer of the third block reverse attention mechanism module is upsampled in the channel dimension, and the number of channels is the same as the output of the first self-attention mechanism module; since the fourth block reverse attention mechanism module needs to be processed in combination with the output (shallow features) of the first convolutional layer, the output feature map of the previous layer of the fourth block reverse attention mechanism module is upsampled in the channel dimension, and the number of channels is the same as the output of the first convolutional layer.
[0136] S21. Use the ResNet34 model and the fully connected layer operation to identify the target. After identifying the target, locate the target center Out center :
[0137] Out center =FC(ResNet34(FC(BN(LeakyReLU(Out upsample )))))
[0138] Among them, ResNet(·) represents the ResNet34 model, BN(·) represents the batch normalization operation, and LeakyReLU(·) represents the activation function operation.
[0139] S22, according to the target center Out center , split each channel feature map into a 32×32 target image, and finally obtain the block target image Out conc :
[0140] Out conc =FG(Out center )
[0141] Among them, FG(Out center ) means: segmentation operation on the target image.
[0142] S23, perform Sigmoid operation on the divided target image to compress the feature map to obtain the compressed target image Out Sigmoid :
[0143] Out Sigmoid =Sigmoid(Out conc )
[0144] Among them, Sigmoid (Out conc ) means: activation function.
[0145] S24, subtract the feature map Out through the all-one vector Sigmoid , get the reverse attention feature map weight Weight ra :
[0146] Weight ra =1-Out Sigmoid
[0147] Among them, "1" means: all-one vector.
[0148] S25, weight the reverse attention feature map ra Multiply point by point with the shallow features at the corresponding position to obtain the weighted convolution feature Weight i :
[0149]
[0150] in, Represents point-by-point multiplication, through Figure 2 It can be seen that the target recognition model mainly has 11 layers (the first layer is: the first convolution layer, the second layer is the first self-attention mechanism module, the third layer is the second self-attention mechanism module, the fourth layer is the third self-attention mechanism module, the fifth layer is the first dilated convolution layer, the sixth layer is the second dilated convolution layer, the seventh layer is the second convolution layer, the eighth layer is the third convolution layer, the ninth layer is the compactness measurement module, the tenth layer is the feature enhancement module, and the eleventh layer is the detection head). When applying the i-th application block reverse attention mechanism module, it is necessary to combine the shallow feature output F corresponding to the 5-i layer network at the corresponding position. {5-i} Specifically, the first block reverse attention mechanism module needs to be processed in combination with the output (shallow features) of the third self-attention mechanism module, the second block reverse attention mechanism module needs to be processed in combination with the output (shallow features) of the second self-attention mechanism module, the third block reverse attention mechanism module needs to be processed in combination with the output (shallow features) of the first self-attention mechanism module, and the fourth block reverse attention mechanism module needs to be processed in combination with the output (shallow features) of the first convolutional layer.
[0151] By adding this weight to the output of the previous layer through a convolution operation, the residual addition image out is obtained. 1 , to fill in the details of features disappearing in deep networks:
[0152] out 1 =Conv(Weight i )+Out Upsample
[0153] The final fused image feature is: the output of the fourth block reverse attention mechanism module, and then the compactness measurement module uses the compactness measurement algorithm to assign different weights to the output channels of the fourth block reverse attention mechanism module. In the compactness measurement algorithm, each pixel value in the final fused image feature is regarded as label∈R 255 , the coordinates of the pixels are regarded as variables; group by label Cluster∈R 255 ; Calculate the average Euclidean distance between all pixels in each group, add the average Euclidean distances calculated for each group to get sum, compactness metric coefficient Weight Compact Take it as the reciprocal of sum. The larger the value of the compactness coefficient, the higher the compactness. Combined with the channel compactness coefficient Weight Compact , a channel with high compactness is assigned a larger weight; a channel with low compactness is assigned a smaller weight. The weight is used for the next feature enhancement operation, which is specifically performed through the feature enhancement module. The feature enhancement module uses the convolution plus dilated convolution module to enhance the features of the final fused image after the weight is assigned. The reason for using the convolution plus dilated convolution module is that the receptive field of the convolution layer is small, and the target features are effectively extracted. The dilated convolution receptive field is larger than the convolution layer receptive field, and long-distance information can be obtained to make up for the shortcomings of the convolution layer due to its small receptive field and the insufficient extraction of features. Although the sparse sampling of the dilated convolution will cause some pixels to be unused, destroying the continuity and correlation of the information, this disadvantage can be well avoided due to the non-local correlation of the target image background. The convolution layer and the dilated convolution layer complement each other, make up for each other's shortcomings, and combine with each other to obtain near and far information, and extract more refined enhanced final fused image features F, which is specifically realized by the following calculation formula:
[0154]
[0155] F=DConv(Conv(Weight Compact ))
[0156] Among them, DConv(·) represents: dilated convolution operation, Cluster j Represents: the average Euclidean distance between all pixels in the jth group Cluster j ,(x l ,y l ) means: represents the coordinates of the lth pixel, (x r ,yr ) means: the coordinates of the rth pixel, label j Indicates: j-th group label, sum j It means: the sum of the average Euclidean distances between all pixels in the jth group.
[0157] Through this strategy of gradual fusion of shallow features and deep features (specifically reflected in the processing process of sample images by the network structure in the target recognition model of the present invention), the feature information from different levels of the network is refined through block reverse attention, and finally the enhanced final fused image feature F is obtained, and more accurate target recognition can be made through the detection head.
[0158] The present invention extracts the target in a given picture, i.e., the target image, by constructing a target detection model, i.e., a target recognition model, based on deep semantic analysis. To this end, the present invention combines the local correlations of the encoder-decoder respectively through the block reverse attention mechanism module for feature characterization, so as to perform feature extraction, and the overall structure is similar to the encoder-decoder structure of the Unet network. Among them, the encoder is composed of a convolution module and an attention module, and the decoder is composed of an expansion convolution module and a feature enhancement module. Through the local receptive field of the traditional convolutional neural network and the attention module, the target features can be effectively enhanced and the noise can be suppressed. The expansion convolution module and the feature enhancement module make full use of the deep feature characteristics to process the deep features of the network in a more refined manner. Secondly, different from the previous methods, we perform jump connection between the encoder and the decoder through block reverse attention to achieve cross-layer feature fusion. The information extracted from the encoder and decoder is fused, and the fused feature channels are weighted by the compactness attention algorithm, giving high weight values to high compactness channels, and using this weight to obtain the final target prediction map in the feature enhancement and detection head stage, in the hope that the final feature can retain the useful information from the original image to the greatest extent, avoiding the phenomenon of target missing or missed detection due to complex background information or noise. Specifically:
[0159] The encoder stage uses traditional convolutional neural networks and attention mechanisms to extract local features of a given target image and obtain image features at different stages. The decoder stage uses dilated convolution and traditional convolutional neural networks to decode features of a given target image and obtain generated images at different stages. Through the constructed encoder-decoder network structure, the extracted features at different stages are subjected to block-by-block reverse attention operations, and then gradually fused. The channels are weighted through the compactness attention algorithm, and finally the final target prediction map is obtained through feature enhancement and detection head modules.
[0160] Among them, the specific steps of inputting a given target image into a traditional convolutional neural network, passing through a self-attention mechanism and obtaining image features at different extraction stages include:
[0161] In the encoder stage, a traditional convolutional neural network operation is used once, and three attention mechanism operations and feature extraction are performed to obtain different features of four stages.
[0162] Among them, the specific steps of using dilated convolution and traditional convolutional neural network to extract deep network features of images include:
[0163] First, this part includes three feature extraction layers. The first layer uses an expanded convolution layer, and the last two layers use a 3×3 convolution kernel assisted by batch attention (BatchNormalization, BN) and ReLU activation function convolution layers, and perform image generation to obtain different images in three stages.
[0164] Among them, for each layer of feature maps in the decoder, the corresponding feature maps are first generated through the convolution layer.
[0165] Among them, the image features extracted in the encoder stage are connected with the shallow features of the decoder.
[0166] Among them, when connecting different parts, for the shallow features of the encoder stage, the image around the target is first segmented through a blocking strategy. The segmented feature image is connected to the deep features of the corresponding stage of the decoder through a reverse attention mechanism, and then a residual connection is made, thereby supplementing the missing information of the deep network on the target.
[0167] Among them, the feature map output by the block reverse attention mechanism is used as the input of the next layer of convolution in the decoder.
[0168] In the block reverse attention mechanism module, the deep features are first upsampled to be consistent with the shallow feature space dimensions, and the input target image is divided into blocks through the ResNet34 model and the fully connected layer. After the generated image passes the Sigmoid activation function, the feature map is subtracted from the all-one vector to obtain the block reverse attention weight, and the weight is applied to the shallow features to fuse the deep features, and then the feature map of this stage is obtained through convolution operations and residual connections. Finally, the feature map after the convolution layer of the three-layer decoder is enhanced with the channel attention through the compactness measurement algorithm. For channels with high compactness, a larger weight is assigned; for channels with low compactness, a smaller weight is assigned; and the weight is used for feature enhancement, and finally the target prediction map is output through the detection head. By constructing an encoder-decoder model, target detection is achieved for a given target image.
[0169] The present invention first extracts shallow features from the input image through convolution and multi-layer attention modules. At this time, the feature map processed in the encoding stage is small, but the resolution and receptive field of the convolution operation are large. To this end, the present invention designs a layer of dilated convolution to expand the receptive field so that it can process a larger range of pixels, thereby transitioning to the decoder stage. In the decoder stage, each layer of feature map and the shallow features of the encoder stage are subjected to block reverse attention processing for feature compensation, so that the encoder stage and the decoder stage are jump-connected and gradually merged, and finally the channel compactness weight is obtained through the compactness measurement algorithm, and the final target prediction is made through feature enhancement and detection head, specifically:
[0170] 1) Encoder stage: Use convolutional neural network and multi-layer attention mechanism to extract image features.
[0171] 2) In the decoder stage, each layer of feature map is processed with the shallow features of the encoder stage by block reverse attention for progressive fusion and feature enhancement. Finally, the compactness measurement algorithm is used to perform attention operations on the channels, and different weights are assigned to channels with different compactness. Feature enhancement operations are performed on the channel images, and the final target prediction map, i.e., the target prediction result, is generated through the detection head.
[0172] The target recognition model of the present invention and the existing IPI model, RIPT model, PSTNN model, ACM model, AGPCNet model, DNANet model, RKFormer model and ISNet model are trained using international standard data sets, and the performance of the trained models is evaluated using multiple evaluation indicators. The international standard data sets can be: NUAA data set, IRSTD1K data set, SIRSTAUG data set and NUDT data set. The source of each data set is as follows Figure 4 shown.
[0173] Among them, the sources of RIPT model, PSTNN model, ACM model, AGPCNet model, DNANet model, RKFormer model and ISNet model are as follows Figure 5 shown.
[0174] Among them, multiple evaluation indicators include: IoU, nIoU and F1-score. The introduction of IoU, nIoU and F1-score is as follows Figure 6 shown.
[0175] Figure 7 The comparison data of the detection results of the trained model are shown, and it can be seen that the present invention improves the accuracy of the target recognition results compared with the existing model.
[0176] In the above embodiments, although the steps are numbered S1, S2, etc., these are only specific embodiments given by the present invention. Those skilled in the art may adjust the execution order of S1, S2, etc. according to actual conditions, which is also within the protection scope of the present invention. It can be understood that in some embodiments, some or all of the above embodiments may be included.
[0177] like Figure 8 As shown, a target recognition system 200 according to an embodiment of the present invention includes a model building module 201, a model training module 202 and a target recognition module 203;
[0178] The model construction module 201 is used to: construct a target recognition model, which includes: an encoder, a decoder and a detection head, wherein the encoder is used to: use a convolutional layer and a self-attention mechanism to obtain image features of sample images at different stages; the decoder is used to: progressively fuse the image features of the sample images at different stages, assign different weights to the final fused image features, and then perform feature enhancement operations to obtain enhanced final fused image features; the detection head is used to: process the enhanced final fused image features to obtain target recognition results of the sample images;
[0179] The model training module 202 is used to: train the target recognition model to obtain a trained target recognition model;
[0180] The target recognition module 203 is used to: use the trained target recognition model to recognize the preset image and obtain the target recognition result of the preset image.
[0181] Optionally, in the above technical solution, the decoder is specifically used to: use the dilated convolution layer, the block reverse attention mechanism module and the convolution layer to progressively fuse the image features of the sample image at different stages, assign different weights to the final fused image features, and then perform feature enhancement operations to obtain the enhanced final fused image features.
[0182] Optionally, in the above technical solution, the encoder includes a first convolutional layer, a first self-attention mechanism module, a second self-attention mechanism module and a third self-attention mechanism module arranged in sequence; the first self-attention mechanism module, the second self-attention mechanism module and the third self-attention mechanism module are used to process each received data through the self-attention mechanism;
[0183] Use the output of the first convolutional layer as the input of the first self-attention mechanism module;
[0184] Use the output of the first self-attention mechanism module as the input of the second self-attention mechanism module;
[0185] The output of the second self-attention mechanism module is used as the input of the third self-attention mechanism module;
[0186] The image features of the sample image at different stages include: the output of the first convolutional layer, the output of the first self-attention mechanism module, the output of the second self-attention mechanism module, and the output of the third self-attention mechanism module.
[0187] Optionally, in the above technical solution, the decoder includes a first dilated convolution layer, a first block reverse attention mechanism module, a second dilated convolution layer, a second block reverse attention mechanism module, a second convolution layer, a third block reverse attention mechanism module, a third convolution layer, a fourth block reverse attention mechanism module, a compactness measurement module and a feature enhancement module, which are arranged in sequence;
[0188] Use the output of the third self-attention mechanism module as the input of the first dilated convolutional layer;
[0189] The output of the first convolutional layer is also used as the input of the fourth block reverse attention mechanism module;
[0190] The output of the first self-attention mechanism module is also used as the input of the third block reverse attention mechanism module;
[0191] The output of the second self-attention mechanism module is also used as the input of the second block reverse attention mechanism module;
[0192] The output of the third self-attention mechanism module is used as the input of the first dilated convolutional layer and as the input of the first block reverse attention mechanism module;
[0193] The output of the first dilated convolutional layer is used as the input of the first block-wise reverse attention mechanism module;
[0194] The output of the first block reverse attention mechanism module is used as the input of the second dilated convolutional layer;
[0195] The output of the second dilated convolutional layer is used as the input of the second block-wise reverse attention mechanism module;
[0196] The output of the second block reverse attention mechanism module is used as the input of the second convolutional layer;
[0197] The output of the second convolutional layer is used as the input of the third block reverse attention mechanism module;
[0198] The output of the third block reverse attention mechanism module is used as the input of the third convolutional layer;
[0199] The output of the third convolutional layer is used as the input of the fourth block reverse attention mechanism module;
[0200] The first block reverse attention mechanism module, the second block reverse attention mechanism module, the third block reverse attention mechanism module and the fourth block reverse attention mechanism module are used to perform feature fusion on the data received respectively;
[0201] The output of the fourth block reverse attention mechanism module is the final fused image feature, which is input into the compactness measurement module. The compactness measurement module assigns different weights to the final fused image feature, and then the feature enhancement operation is performed by the feature enhancement module to obtain the enhanced final fused image feature.
[0202] It should be noted that the beneficial effects of a target recognition system 200 provided in the above embodiment are the same as the beneficial effects of the above target recognition method, which will not be described in detail here. In addition, when the system provided in the above embodiment realizes its functions, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the system can be divided into different functional modules according to actual conditions to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be described in detail here.
[0203] Among them, the target recognition system of the present invention can be a computer program (including program code) running in a computer device. For example, the target recognition system of the present invention is an application software that can be used to execute the corresponding steps in the target recognition method of the present invention.
[0204] In some embodiments, the target identification system of the present invention can be implemented by a combination of software and hardware. As an example, the target identification system of the present invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the target identification method of the present invention. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs) or other electronic components.
[0205] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The name of a module does not limit the module itself in some cases.
[0206] An electronic device according to an embodiment of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, any one of the above-mentioned target recognition methods is implemented. That is to say, an electronic device according to an embodiment of the present invention may include but is not limited to: a processor and a memory; a memory for storing a computer program; a processor for executing a target recognition method shown in any embodiment of the present invention by calling a computer program.
[0207] In an alternative embodiment, an electronic device is provided, such as Fig. 9 As shown, Fig. 9 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004, which may be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present invention.
[0208] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0209] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9In the figure, only one thick line is used to represent the bus 4002, but this does not mean that there is only one bus or one type of bus.
[0210] The memory 4003 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.
[0211] The memory 4003 is used to store the application code (computer program) for executing the solution of the present invention, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the application code stored in the memory 4003 to implement the content shown in the above method embodiment.
[0212] The electronic device may also be a terminal device, which may be any device that can install applications, including at least one of a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a smart TV, and a smart car device. Fig. 9 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0213] A computer-readable storage medium according to an embodiment of the present invention stores a computer program, and when the computer program is executed by a processor, any of the above target recognition methods is implemented.
[0214] Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0215] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs any of the above-mentioned target recognition methods.
[0216] Computer program code for performing the operations of the present invention may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0217] It should be understood that the flow charts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the module, the program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0218] The computer-readable storage medium provided by the embodiment of the present invention may be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device, or component.
[0219] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0220] The above description is only a preferred embodiment of the present invention and an explanation of the technical principles used. Those skilled in the art should understand that the disclosure scope involved in the present invention is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) by each other.
[0221] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects and represent the definition of a specific order or sequence. The order of use of similar objects can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than the order shown or described.
[0222] Those skilled in the art know that the present invention can be implemented as a system, method or computer program product. Therefore, the present invention can be specifically implemented in the following forms, namely: it can be complete hardware, it can be complete software (including firmware, resident software, microcode, etc.), or it can be a combination of hardware and software, which is generally referred to as "circuit", "module" or "system" herein. In addition, in some embodiments, the present invention can also be implemented in the form of a computer program product in one or more computer-readable media, and the computer-readable medium contains computer-readable program code.
[0223] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A target recognition method, characterized in that: include: Constructing a target recognition model, the target recognition model includes: an encoder, a decoder and a detection head, the encoder is used to: use a convolution layer and a self-attention mechanism to obtain image features of a sample image at different stages, the decoder is used to: progressively fuse the image features of the sample image at different stages, assign different weights to the final fused image features, and then perform a feature enhancement operation to obtain enhanced final fused image features, and the detection head is used to: process the enhanced final fused image features to obtain a target recognition result of the sample image; Training the target recognition model to obtain a trained target recognition model; The trained target recognition model is used to recognize a preset image to obtain a target recognition result of the preset image.
2. A target recognition method according to claim 1, characterized in that: The decoder is specifically used to: use the dilated convolution layer, the block reverse attention mechanism module and the convolution layer to progressively fuse the image features of the sample image at different stages, assign different weights to the final fused image features, and then perform feature enhancement operations to obtain the enhanced final fused image features.
3. A target recognition method according to claim 2, characterized in that: The encoder includes a first convolutional layer, a first self-attention mechanism module, a second self-attention mechanism module and a third self-attention mechanism module which are arranged in sequence; the first self-attention mechanism module, the second self-attention mechanism module and the third self-attention mechanism module are used to process each received data through the self-attention mechanism; Using the output of the first convolutional layer as the input of the first self-attention mechanism module; Using the output of the first self-attention mechanism module as the input of the second self-attention mechanism module; Using the output of the second self-attention mechanism module as the input of the third self-attention mechanism module; The image features of the sample image at different stages include: the output of the first convolutional layer, the output of the first self-attention mechanism module, the output of the second self-attention mechanism module and the output of the third self-attention mechanism module.
4. A target recognition method according to claim 3, characterized in that: The decoder includes a first dilated convolution layer, a first block reverse attention mechanism module, a second dilated convolution layer, a second block reverse attention mechanism module, a second convolution layer, a third block reverse attention mechanism module, a third convolution layer, a fourth block reverse attention mechanism module, a compactness measurement module and a feature enhancement module, which are arranged in sequence; Using the output of the third self-attention mechanism module as the input of the first dilated convolutional layer; The output of the first convolutional layer is also used as the input of the fourth block reverse attention mechanism module; The output of the first self-attention mechanism module is also used as the input of the third block reverse attention mechanism module; The output of the second self-attention mechanism module is also used as the input of the second block reverse attention mechanism module; Using the output of the third self-attention mechanism module as the input of the first dilated convolutional layer and as the input of the first block reverse attention mechanism module; Using the output of the first dilated convolutional layer as the input of the first block-wise reverse attention mechanism module; Using the output of the first block reverse attention mechanism module as the input of the second dilated convolutional layer; Using the output of the second dilated convolutional layer as the input of the second block-wise reverse attention mechanism module; Using the output of the second block reverse attention mechanism module as the input of the second convolutional layer; Using the output of the second convolutional layer as the input of the third block reverse attention mechanism module; Using the output of the third block reverse attention mechanism module as the input of the third convolutional layer; Using the output of the third convolutional layer as the input of the fourth block reverse attention mechanism module; The first block reverse attention mechanism module, the second block reverse attention mechanism module, the third block reverse attention mechanism module and the fourth block reverse attention mechanism module are used to perform feature fusion on the data received by each of them; The output of the fourth block reverse attention mechanism module is the final fused image feature, which is input into the compactness measurement module. The compactness measurement module performs an attention operation on the final fused image feature and assigns different weights, and then performs a feature enhancement operation through the feature enhancement module to obtain the enhanced final fused image feature.
5. A target recognition system, characterized in that: It includes model building module, model training module and target recognition module; The model building module is used to build a target recognition model, which includes an encoder, a decoder and a detection head, wherein the encoder is used to obtain image features of sample images at different stages by using a convolutional layer and a self-attention mechanism; the decoder is used to progressively fuse the image features of the sample images at different stages, assign different weights to the final fused image features, and then perform feature enhancement operations to obtain enhanced final fused image features; the detection head is used to process the enhanced final fused image features to obtain target recognition results of the sample images; The model training module is used to: train the target recognition model to obtain a trained target recognition model; The target recognition module is used to: use the trained target recognition model to recognize the preset image to obtain the target recognition result of the preset image.
6. A target recognition system according to claim 5, characterized in that: The decoder is specifically used to: use the dilated convolution layer, the block reverse attention mechanism module and the convolution layer to progressively fuse the image features of the sample image at different stages, assign different weights to the final fused image features, and then perform feature enhancement operations to obtain the enhanced final fused image features.
7. A target recognition system according to claim 6, characterized in that: The encoder includes a first convolutional layer, a first self-attention mechanism module, a second self-attention mechanism module and a third self-attention mechanism module which are arranged in sequence; the first self-attention mechanism module, the second self-attention mechanism module and the third self-attention mechanism module are used to process each received data through the self-attention mechanism; Using the output of the first convolutional layer as the input of the first self-attention mechanism module; Using the output of the first self-attention mechanism module as the input of the second self-attention mechanism module; Using the output of the second self-attention mechanism module as the input of the third self-attention mechanism module; The image features of the sample image at different stages include: the output of the first convolutional layer, the output of the first self-attention mechanism module, the output of the second self-attention mechanism module and the output of the third self-attention mechanism module.
8. A target recognition system according to claim 7, characterized in that: The decoder includes a first dilated convolution layer, a first block reverse attention mechanism module, a second dilated convolution layer, a second block reverse attention mechanism module, a second convolution layer, a third block reverse attention mechanism module, a third convolution layer, a fourth block reverse attention mechanism module, a compactness measurement module and a feature enhancement module, which are arranged in sequence; Using the output of the third self-attention mechanism module as the input of the first dilated convolutional layer; The output of the first convolutional layer is also used as the input of the fourth block reverse attention mechanism module; The output of the first self-attention mechanism module is also used as the input of the third block reverse attention mechanism module; The output of the second self-attention mechanism module is also used as the input of the second block reverse attention mechanism module; Using the output of the third self-attention mechanism module as the input of the first dilated convolutional layer and as the input of the first block reverse attention mechanism module; Using the output of the first dilated convolutional layer as the input of the first block-wise reverse attention mechanism module; Using the output of the first block reverse attention mechanism module as the input of the second dilated convolutional layer; Using the output of the second dilated convolutional layer as the input of the second block-wise reverse attention mechanism module; Using the output of the second block reverse attention mechanism module as the input of the second convolutional layer; Using the output of the second convolutional layer as the input of the third block reverse attention mechanism module; Using the output of the third block reverse attention mechanism module as the input of the third convolutional layer; Using the output of the third convolutional layer as the input of the fourth block reverse attention mechanism module; The first block reverse attention mechanism module, the second block reverse attention mechanism module, the third block reverse attention mechanism module and the fourth block reverse attention mechanism module are used to perform feature fusion on the data received by each of them; The output of the fourth block reverse attention mechanism module is the final fused image feature, which is input into the compactness measurement module. The compactness measurement module performs an attention operation on the final fused image feature and assigns different weights, and then performs a feature enhancement operation through the feature enhancement module to obtain the enhanced final fused image feature.
9. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a target recognition method as claimed in any one of claims 1 to 4 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the target recognition method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Medical image segmentation method based on adaptive scale
CN113628191A
Miao nationality costume image semantic segmentation method
CN114037833A
Medical image segmentation method fusing multi-scale features and attention mechanism
CN114119638A
Retinal blood vessel image segmentation method and device and computer equipment
CN114283158A
Polyp segmentation method combining attention U-shaped network and multi-scale feature fusion
CN114820635A