Target recognition method, system, electronic device and storage medium

By constructing a target recognition model with an encoder-decoder structure and combining self-attention and block-wise reverse attention mechanisms, the accuracy and robustness issues of small target detection in complex backgrounds are solved, and efficient and accurate extraction of small targets in multimodal document images is achieved, which is suitable for the automated processing of bidding documents in the power industry.

CN119785007BActive Publication Date: 2025-09-26WENZHOU ELECTRIC POWER DESIGN CO LTD PUHUA TENDERING CONSULTING BRANCH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411925172.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-09-26
Estimated Expiration
2044-12-25

AI Technical Summary

Technical Problem

Existing small target detection algorithms have difficulty achieving high-precision and robust detection in the presence of complex background information or large local noise, especially in multimodal document images, where small targets are scattered, diverse, and have low criticality and error tolerance. Existing methods find it difficult to effectively extract key information.

Method used

The target recognition model is constructed using an encoder-decoder structure, combined with convolutional layers and self-attention mechanisms. Feature fusion and enhancement are performed through a block-wise reverse attention mechanism to suppress noise, refine deep features, and achieve target recognition.

Benefits of technology

Under complex background information and noisy environments, it can efficiently and accurately extract small targets in multimodal document images, improving detection accuracy and robustness, and is suitable for the automated processing of bidding documents in the power industry.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119785007B_ABST
    Figure CN119785007B_ABST
Patent Text Reader

Abstract

The present invention discloses a target recognition method, system, electronic device and storage medium, and relates to the field of image recognition technology. The method comprises: constructing a target recognition model, the target recognition model comprising: 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; the detection head is used to: process the enhanced final fused image features to obtain a target recognition result of the sample image; train the target recognition model to obtain a trained target recognition model; and use the trained target recognition model to recognize a preset image to obtain a target recognition result of the preset image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition technology, and in particular to a target recognition method, system, electronic device and storage medium. 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 target data with the most visual significance. 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. These small targets usually represent key information such as device names, technical parameters, and prices. Although small in size, their information value is extremely high. By extracting these targets, it is possible to quickly identify the key content in the document and avoid missing key details. The small targets here have the following characteristics:

[0003] 1) Scattered and Highly Diverse: Small objects often include contract terms, device models, and parameter tables. This information is distributed across different areas of the document image and exhibits high diversity. Small objects may appear as text, charts, or images, and their position and layout are not fixed, increasing 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 contexts, such as numerical values ​​in tables, technical parameters with accompanying explanations, or annotations in schematics. This multimodal nature requires algorithms that can integrate textual 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, misinterpretation 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. 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 existing small target detection algorithms to make good predictions. Therefore, how to improve the performance and application effect of small target detection algorithms remains a hot topic and difficulty in current research in this field.

[0006] Small target detection requires not only special attention to small targets in an image, but also consideration of relevant feature information such as the background and noise in the image. 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 each have their own advantages, but each algorithm also has significant shortcomings. For example, CNN-based deep learning methods are not effective in segmenting small targets, lacking clear contours and texture features; filter-based methods struggle to achieve significant results in complex scenarios. Complex background information, noise interference, and small target size are characteristics of small target images, which also pose certain challenges to 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 existing technology 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, the specific technical solution of which 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 using convolutional layers and a self-attention mechanism. 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 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 results 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 be further improved as follows.

[0013] Furthermore, 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;

[0014] The output of the first convolutional layer is used as the input of the first self-attention mechanism module;

[0015] The output of the first self-attention mechanism module is used 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] Furthermore, 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] The output of the third self-attention mechanism module is used 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-wise reverse attention mechanism module;

[0024] The output of the first dilated convolutional layer is used as the input of the first block-wise inverse attention mechanism module;

[0025] The output of the first block-wise inverse 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 inverse 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 a second aspect, the present invention further provides a target recognition system, the specific technical solution of which is as follows:

[0034] Includes model building module, model training module and target recognition module;

[0035] The model construction module is used to build a target recognition model, which includes an encoder, a decoder, and a detection head. The encoder is used to use convolutional layers and a self-attention mechanism to obtain the image features of the 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 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 results 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, the target recognition system of the present invention can be further improved as follows.

[0039] Furthermore, the decoder is specifically used to: use the dilated convolution layer, the block inverse 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] Furthermore, 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;

[0041] The output of the first convolutional layer is used 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] Furthermore, 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] The output of the third self-attention mechanism module is used 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-wise reverse attention mechanism module;

[0051] The output of the first dilated convolutional layer is used as the input of the first block-wise inverse attention mechanism module;

[0052] The output of the first block-wise inverse 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 inverse 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 coupled to a memory, wherein the memory stores at least one computer program, and the at least one computer program is 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, which implements any of the above-mentioned target recognition methods when executed by a processor.

[0062] The beneficial effects of the present invention are as follows:

[0063] The encoder-decoder structure constructed by the present invention is a target recognition model, which can enhance target features and suppress noise on the one hand, and refine deep features through dilated convolution and feature enhancement modules on the other hand. The present invention jumps the encoder (shallow features) and the decoder (deep features), which can achieve the fusion of deep and shallow features, thereby better extracting the deep semantic features of the image. We innovatively introduce block attention into the jump connection between the encoder and the decoder, and combine the characteristics of the target image in the target image that the target is in the form of points 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 flow chart 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 Schematic diagram of the network structure of the block reverse attention mechanism module;

[0068] Figure 4 This is a schematic diagram of the introduction of the international standard dataset;

[0069] Figure 5 Schematic diagram of the introduction of 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 Schematic diagram of comparative data of the detection results of the trained model;

[0072] Figure 8 A schematic structural diagram of a target recognition system according to an embodiment of the present invention;

[0073] Figure 9The figure is a schematic structural diagram 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 following describes in detail the technical solution of the present invention and how the technical solution of the present invention solves the above-mentioned technical problems using 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 following embodiments of the present invention are described in conjunction with the accompanying drawings.

[0076] like Figure 1 As shown, a target recognition method according to an embodiment of the present invention includes 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 using convolutional layers and a self-attention mechanism. 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 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. Train 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] In the context of the digital transformation of the power industry, traditional methods of processing bidding documents face the problems of low efficiency, prone to 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 image in the bidding document is used as a sample image, and the multimodal small targets in the sample images (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 to 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, etc. 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 inverse 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 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] The output of the first convolutional layer is used as the input of the first self-attention mechanism module;

[0086] The output of the first self-attention mechanism module is used 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] The output of the third self-attention mechanism module is used 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-wise reverse attention mechanism module;

[0096] The output of the first dilated convolutional layer is used as the input of the first block-wise inverse attention mechanism module;

[0097] The output of the first block-wise inverse 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 inverse 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 recorded 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 I1, I1∈R {H″×W″×1} , the second intermediate feature map is I2, I2∈R {H″′×W″′×1} , I1=PW1(I), I2=PW2(I), PW1(I) means: point-by-point convolution operation is performed on I through the first point-by-point convolution layer, and PW2(I) means: point-by-point convolution operation is performed on I 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. Therefore, I1 and I2 must be different, and H ′ =H ″ =H ″′ , W ′ =W ″ =W ″′ .

[0109] S12, performing a reshape operation on the first intermediate feature map I1 and the second intermediate feature map I2, and then obtaining the attention feature input q of the reshaped first intermediate feature map I1 and the attention feature input k of the reshaped second intermediate feature map I2 through the fully connected layer, which is specifically implemented by the following formula:

[0110] q=FC(reshape(I1))

[0111] k=FC(reshape(I2))

[0112] Where q∈R {H′×1} , k∈R {1×H′} , reshape(I1) means: reshape the first intermediate feature map I1, FC(reshape(I1)) means: obtain the attention feature input q of the first intermediate feature map I1 after reshape through the fully connected layer, reshape(I2) means: reshape the second intermediate feature map I2, FC(reshape(I2)) means: obtain the attention feature input k of the second intermediate feature map I2 after reshape through the fully connected layer.

[0113] S13. Perform matrix multiplication on the attention feature input q of the reshaped first intermediate feature map I1 and the attention feature input k of the reshaped second intermediate feature map I2, and perform point-by-point convolution and softmax operations to obtain the attention matrix attention:

[0114] attention = softmax(PW(q×k))

[0115] Among them, attention∈R {H′×H′×C′} , q×k means: matrix multiplication of the attention feature input q of the first intermediate feature map I1 after reshaping and the attention feature input k of the second intermediate feature map I2 after reshaping, PW(q×k) means: point-by-point convolution operation on q×k through the point-by-point convolution layer, and softmax(PW(q×k)) means: softmax operation 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 convolution operation on the received feature I through the convolution layer.

[0119] S15, the attention matrix attention and convolution feature I conv Multiply channel by 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 receive the feature I, convolution feature I conv and 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 convolution layer to fused features Perform convolution operation, Representation: The fused features are obtained through point-by-point convolutional layers Perform point-by-point convolution operation, 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, through continuous optimization and learning, can effectively perceive the location of the target. Stacking three self-attention mechanism modules layer by layer effectively enhances target features, suppresses noise, and solves 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 the convolution operation and the 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 the 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 Perform upsampling operations. 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 target image after block division 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 ) indicates: 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 out1 is obtained to supplement the details of the features that disappear in the deep network:

[0152] out1=Conv(Weight i )+Out Upsample

[0153] Among them, 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 pixel points 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 the reciprocal of sum, the larger the value of compactness coefficient, the higher the compactness. Combined with the channel compactness coefficient Weight Compact , a channel with high compactness is given a larger weight; a channel with low compactness is given a smaller weight. And the next feature enhancement operation is performed with this weight, specifically through the feature enhancement module. The feature enhancement module uses the convolution plus dilated convolution module to enhance the final fused image features after the weight is assigned. The reason for using the convolution plus dilated convolution module is: 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 can obtain long-distance information, which is used to make up for the shortcoming that the convolution layer is not fine enough in extracting features due to its small receptive field. Although the sparse sampling of the dilated convolution will cause some pixels to be unused, destroying the continuity and correlation of the information, due to the non-local correlation of the target image background, this disadvantage can be well avoided. The convolution layer and the dilated convolution layer complement each other, make up for each other's shortcomings, combine with each other to obtain near and far information, and extract more refined enhanced final fused image features F, which is specifically achieved through 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 ,y r ) means: the coordinates of the rth pixel, labelj Indicates: j-th group label, sum j It represents 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 process of processing 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 the enhanced final fused image feature F is finally obtained, which can make more accurate target recognition through the detection head.

[0158] The present invention extracts the target in a given picture, namely the target image, by constructing a target detection model, namely a target recognition model, based on deep semantic analysis. To this end, the present invention combines the local correlations of the encoder and decoder respectively through the block reverse attention mechanism module to perform feature characterization in order to perform feature extraction. 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 expanded 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 expanded convolution module and the feature enhancement module make full use of the deep feature characteristics and process the deep features of the network in a more refined manner. Secondly, unlike previous methods, we perform jump connections 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. This weight is used to obtain the final target prediction map in the feature enhancement and detection head stages, in the hope that the final features can retain the useful information from the original image to the greatest extent possible, avoiding the phenomenon of target loss or missed detection due to complex background information or noise. Specifically:

[0159] The encoder stage utilizes traditional convolutional neural networks and an attention mechanism to extract local features from a given target image and generate image features at different stages. The decoder stage utilizes dilated convolutions and traditional convolutional neural networks to decode the features of the given target image and generate generated images at different stages. Through the constructed encoder-decoder network structure, the extracted features at different stages are subjected to block-wise reverse attention operations, which are then progressively fused. A compact attention algorithm is used to weight the channels, ultimately yielding the final target prediction image through feature enhancement and detection head modules.

[0160] The specific steps of inputting a given target image into a traditional convolutional neural network, passing through the 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, an attention mechanism operation is used three times, and feature extraction is performed to obtain different features of four stages.

[0162] The specific steps of using dilated convolution and traditional convolutional neural networks to extract deep network features from 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 supplemented by batch attention (BatchNormalization, BN) and ReLU activation function. Image generation is performed 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 then passed through a reverse attention mechanism and residually connected with the deep features of the corresponding stage of the decoder, 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-wise inverse attention mechanism module, the input target image is first divided into blocks by upsampling deep features to align with the spatial dimensions of shallow features. This is then processed through a ResNet34 model and fully connected layers. After the generated image is activated by a Sigmoid function, the block-wise inverse attention weights are subtracted from the feature map using an all-ones vector. These weights are then applied to the shallow features to fuse the deep features. The feature map for this stage is then obtained through convolution operations and residual connections. Finally, the feature map after the convolutional layers of the three-layer decoder is enhanced with channel attention using a compactness metric algorithm. Channels with high compactness are assigned a larger weight, while channels with low compactness are assigned a smaller weight. These weights are then used for feature enhancement, and the detection head outputs a target prediction map. By constructing an encoder-decoder model, object 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 by the encoding stage is small, but the resolution and receptive field of the convolution operation are large. To this end, the present invention expands the receptive field by designing a layer of dilated convolution, 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 networks and multi-layer attention mechanisms to extract image features.

[0171] 2) In the decoder stage, each layer's feature map is subjected to block-wise reverse attention processing with shallow features from the encoder stage for progressive fusion and feature enhancement. Finally, a compactness metric algorithm performs an attention operation on the channels, assigning different weights to channels with different compactness levels. Feature enhancement is performed on these channel images, and the detection head generates the final target prediction map, i.e., the target prediction result.

[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 datasets, and the performance of the trained models is evaluated using multiple evaluation indicators. Among them, the international standard datasets can be: NUAA dataset, IRSTD1K dataset, SIRSTAUG dataset and NUDT dataset. The source of each dataset 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. 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 scope of protection 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, an object recognition system 200 according to an embodiment of the present invention includes a model building module 201, a model training module 202 and an object 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. The encoder is used to use a convolutional layer and a self-attention mechanism to obtain image features of the 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 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 image.

[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 recognize a preset image using a trained target recognition model to obtain a 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 inverse 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] The output of the first convolutional layer is used as the input of the first self-attention mechanism module;

[0184] The output of the first self-attention mechanism module is used 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] The output of the third self-attention mechanism module is used 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-wise reverse attention mechanism module;

[0193] The output of the first dilated convolutional layer is used as the input of the first block-wise inverse attention mechanism module;

[0194] The output of the first block-wise inverse 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 inverse 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 the target recognition system 200 provided in the above embodiment are the same as the beneficial effects of the above target recognition method, and will not be repeated here. In addition, when implementing its functions, the system provided in the above embodiment is only illustrated by the division of the above functional modules. 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. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0203] The target recognition system of the present invention may 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 recognition system of the present invention can be implemented by a combination of software and hardware. As an example, the target recognition system of the present invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the target recognition 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 described in the embodiments of the present invention may be implemented in software or hardware, and the name of a module does not necessarily limit the module itself.

[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 runnable on the processor. When the processor executes the computer program, any one of the above-mentioned target recognition methods is implemented. That is, an electronic device according to an embodiment of the present invention may include but is not limited to: a processor and a memory; the memory is used to store the computer program; the processor is used to execute the target recognition method shown in any embodiment of the present invention by calling the computer program.

[0207] In an alternative embodiment, an electronic device is provided, such as Figure 9 As shown, Figure 9 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data exchange 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 number of transceivers 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 the various exemplary logic blocks, modules, and circuits described in conjunction with the present disclosure. 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, and the like.

[0209] Bus 4002 may include a path for transmitting information between the above components. Bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. Bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 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 may 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 compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.

[0211] The memory 4003 is used to store application code (computer program) for executing the solution of the present invention, and 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 smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, smart TV, and smart car device. Figure 9 The electronic device shown is only an example and should not limit 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, which implements any of the above-mentioned target recognition methods when executed by a processor.

[0214] Alternatively, 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, or the like.

[0215] In an exemplary embodiment, a computer program product or computer program is also provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform any of the above-described object 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 stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the 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 flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for implementing 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 different order than the order 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 flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or can be implemented using a combination of dedicated hardware and computer instructions.

[0218] The computer-readable storage medium provided in the embodiments 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 can be used by or in combination 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 merely a preferred embodiment of the present invention and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present invention is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in the present invention.

[0221] It should be noted that the terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects and to define a specific order or precedence. Where appropriate, the order used for similar objects may be interchanged, such 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 will appreciate that the present invention may be implemented as a system, method, or computer program product. Therefore, the present invention may be implemented in the following forms: entirely in hardware, entirely in software (including firmware, resident software, microcode, etc.), or in a combination of hardware and software, generally referred to herein as a "circuit," "module," or "system." Furthermore, in some embodiments, the present invention may be implemented in the form of a computer program product embodied in one or more computer-readable media containing computer-readable program code.

[0223] Although the embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and are not to be construed as limitations on the present invention. A person skilled in the art may change, modify, replace and modify 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 convolutional 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. 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; Using the trained target recognition model to recognize a preset image, and obtaining a target recognition result of the preset image; The decoder is specifically configured to: utilize an expanded convolution layer, a block-wise inverse attention mechanism module, and a 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 a feature enhancement operation to obtain enhanced final fused image features; 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; 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-wise reverse attention mechanism module; Using the output of the first dilated convolutional layer as the input of the first block-wise inverse attention mechanism module; Using the output of the first block-wise inverse 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 inverse attention mechanism module; Using the output of the second block-wise inverse 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-wise inverse attention mechanism module; Using the output of the third block inverse 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 respectively; 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 to the final fused image feature. The feature enhancement module then performs a feature enhancement operation on the final fused image feature to obtain the enhanced final fused image feature. Among them, the data processing process of each self-attention mechanism module is as follows: S11, the self-attention mechanism module uses two point-by-point convolutional layers to process the received features and obtain the first intermediate feature map I1 and the second intermediate feature map I2, where the received features are I, I∈R{ H′×W′×C′ }; S12, performing a reshape operation on the first intermediate feature map I1 and the second intermediate feature map I2, and then obtaining the attention feature input q of the reshaped first intermediate feature map I1 and the attention feature input k of the reshaped second intermediate feature map I2 through the fully connected layer, which is specifically implemented by the following formula: q=FC(reshape(I1)) k=FC(reshape(I2)) Where q∈R {H′×1} , k∈R {1×H′} , reshape(I1) means: reshape the first intermediate feature map I1, FC(reshape(I1)) means: obtain the attention feature input q of the reshaped first intermediate feature map I1 through the fully connected layer, reshape(I2) means: reshape the second intermediate feature map I2, FC(reshape(I2)) means: obtain the attention feature input k of the reshaped second intermediate feature map I2 through the fully connected layer; S13, performing matrix multiplication on the attention feature input q of the reshaped first intermediate feature map I1 and the attention feature input k of the reshaped second intermediate feature map I2, and performing point-by-point convolution and softmax operations to obtain the attention matrix attention; S14, process the received feature I through the convolution layer to calculate the convolution feature I conv ; S15, the attention matrix attention and convolution feature I conv Multiply channel by channel to get the attention output feature O attention ; S16, finally receive the feature I, convolution feature I conv and attention output feature O attention Perform feature fusion to obtain the fused features S17, based on the fused features Get the final output feature O: in, Representation: Use the convolution layer to fused features Perform convolution operation, Representation: The fused features are obtained through point-by-point convolutional layers Perform point-by-point convolution operation, Indicates: Yes and Addition; The data processing process of the block-wise inverse attention mechanism module is as follows: first, by upsampling the deep features 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. After the generated image passes the Sigmoid activation function, the feature map is subtracted from the all-one vector to obtain the block-wise inverse attention weight, and the weight is applied to the shallow features to fuse the deep features. Then, the feature map is obtained through convolution operations and residual connections. The specific steps include the following: S20, perform an upsampling operation on the channel dimension of the output feature map out of the previous layer to achieve the feature Out with the same number of channels as the shallow feature upsample : Out upsample =Upsample(out) Among them, Upsample(out) means Out upsample Perform upsampling operation. 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. The previous output feature map of the fourth block reverse attention mechanism module is: the output of the third convolutional layer. 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 : Out center =FC(ResNet34(FC(BN(LeakyReLU(Out upsample ))))) Among them, ResNet(·) represents the ResNet34 model, BN(·) represents the batch normalization operation, and LeakyReLU(·) represents the activation function operation; 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 : Out conc =FG(Out center ) Among them, FG(Out center ) indicates: segmentation operation of target image; S23, perform Sigmoid operation on the target image after block division to compress the feature map to obtain the compressed target image Out Sigmoid ; S24, subtract the feature map Out through the all-one vector Sigmoid , get the reverse attention feature map weight Weight ra ; 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 : in, Represents point-by-point multiplication. The target recognition model consists of 11 layers. The first layer is the first convolutional 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 convolutional layer, the sixth layer is the second dilated convolutional layer, the seventh layer is the second convolutional layer, the eighth layer is the third convolutional 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, the shallow feature output F corresponding to the 5-i layer network at the corresponding position is combined {5-i} The first block reverse attention mechanism module is combined with the output of the third self-attention mechanism module for processing, the second block reverse attention mechanism module is combined with the output of the second self-attention mechanism module for processing, the third block reverse attention mechanism module is combined with the output of the first self-attention mechanism module for processing, and the fourth block reverse attention mechanism module is combined with the output of the first convolutional layer for processing; By adding weighted convolution feature Weight i The residual addition image out1 is obtained by adding the convolution operation to the output of the previous layer to supplement the details of the features that disappear in the deep network: out1=Conv(Weight i )+Out Upsample Then, the enhanced final fused image feature F, i.e., the feature map, is extracted, which is specifically achieved through the following calculation formula: F=DConv(Conv(Weight compact )) 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 ,y r ) means: the coordinates of the rth pixel, label j Indicates: j-th group label, sum j It represents the sum of the average Euclidean distances between all pixels in the jth group.

2. A target recognition system, characterized in that: Includes model building module, model training module and target recognition module; The model construction module is used to construct a target recognition model, which includes an encoder, a decoder, and a detection head. The encoder is used to obtain image features of sample images at different stages 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 a feature enhancement operation to obtain enhanced final fused image features. The detection head is used to process the enhanced final fused image features to obtain a target recognition result of the sample image. 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 and obtain the target recognition result of the preset image; The decoder is specifically configured to: utilize an expanded convolution layer, a block-wise inverse attention mechanism module, and a 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 a feature enhancement operation to obtain enhanced final fused image features; 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; 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-wise reverse attention mechanism module; Using the output of the first dilated convolutional layer as the input of the first block-wise inverse attention mechanism module; Using the output of the first block-wise inverse 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 inverse attention mechanism module; Using the output of the second block-wise inverse 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-wise inverse attention mechanism module; Using the output of the third block inverse 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 respectively; 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 to the final fused image feature. The feature enhancement module then performs a feature enhancement operation on the final fused image feature to obtain the enhanced final fused image feature. Among them, the data processing process of each self-attention mechanism module is as follows: S11, the self-attention mechanism module uses two point-by-point convolutional layers to process the received features and obtain the first intermediate feature map I1 and the second intermediate feature map I2, where the received features are I, I∈R{ H′×W′×C′ }; S12, performing a reshape operation on the first intermediate feature map I1 and the second intermediate feature map I2, and then obtaining the attention feature input q of the reshaped first intermediate feature map I1 and the attention feature input k of the reshaped second intermediate feature map I2 through the fully connected layer, which is specifically implemented by the following formula: q=FC(reshape(I1)) k=FC(reshape(I2)) Where q∈R {H′×1} , k∈R {1×H′} , reshape(I1) means: reshape the first intermediate feature map I1, FC(reshape(I1)) means: obtain the attention feature input q of the reshaped first intermediate feature map I1 through the fully connected layer, reshape(I2) means: reshape the second intermediate feature map I2, FC(reshape(I2)) means: obtain the attention feature input k of the reshaped second intermediate feature map I2 through the fully connected layer; S13, performing matrix multiplication on the attention feature input q of the reshaped first intermediate feature map I1 and the attention feature input k of the reshaped second intermediate feature map I2, and performing point-by-point convolution and softmax operations to obtain the attention matrix attention; S14, process the received feature I through the convolution layer to calculate the convolution feature I conv ; S15, the attention matrix attention and convolution feature I conv Multiply channel by channel to get the attention output feature O attention ; S16, finally receive the feature I, convolution feature I conv and attention output feature O attentiob Perform feature fusion to obtain the fused features S17, based on the fused features Get the final output feature O: in, Representation: Use the convolution layer to fused features Perform convolution operation, Representation: The fused features are obtained through point-by-point convolutional layers Perform point-by-point convolution operation, Indicates: Yes and Addition; The data processing process of the block-wise inverse attention mechanism module is as follows: first, by upsampling the deep features 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. After the generated image passes the Sigmoid activation function, the feature map is subtracted from the all-one vector to obtain the block-wise inverse attention weight, and the weight is applied to the shallow features to fuse the deep features. Then, the feature map is obtained through convolution operations and residual connections. The specific steps include the following: S20, perform an upsampling operation on the channel dimension of the output feature map out of the previous layer to achieve the feature Out with the same number of channels as the shallow feature upsample : Out upsample =Upsample(out) Among them, Upsample(out) means Out upsample Perform upsampling operation. 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. The previous output feature map of the fourth block reverse attention mechanism module is: the output of the third convolutional layer. 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 : Out center =FC(ResNet34(FC(BN(LeakyReLU(Out upsample ))))) Among them, ResNet(·) represents the ResNet34 model, BN(·) represents the batch normalization operation, and LeakyReLU(·) represents the activation function operation; 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 : Out conc =FG(Out center ) Among them, FG(Out center ) indicates: segmentation operation of target image; S23, perform Sigmoid operation on the target image after block division to compress the feature map to obtain the compressed target image Out Sigmoid ; S24, subtract the feature map Out through the all-one vector Sigmoid , get the reverse attention feature map weight weight ra ; 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 : in, Represents point-by-point multiplication. The target recognition model consists of 11 layers. The first layer is the first convolutional 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 convolutional layer, the sixth layer is the second dilated convolutional layer, the seventh layer is the second convolutional layer, the eighth layer is the third convolutional 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, the shallow feature output F corresponding to the 5-i layer network at the corresponding position is combined {5-i} The first block reverse attention mechanism module is combined with the output of the third self-attention mechanism module for processing, the second block reverse attention mechanism module is combined with the output of the second self-attention mechanism module for processing, the third block reverse attention mechanism module is combined with the output of the first self-attention mechanism module for processing, and the fourth block reverse attention mechanism module is combined with the output of the first convolutional layer for processing; By adding weighted convolution feature Weight i The residual addition image out1 is obtained by adding the convolution operation to the output of the previous layer to supplement the details of the features that disappear in the deep network: out1=Conv(Weight i )+Out Upsample Then, the enhanced final fused image feature F, i.e., the feature map, is extracted, which is specifically achieved through the following calculation formula: F=DConv(Conv(Weight comoact )) 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 ,y r ) means: the coordinates of the rth pixel, label j Indicates: j-th group label, sum j It represents the sum of the average Euclidean distances between all pixels in the jth group.

3. 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 the processor implements the target recognition method according to claim 1 when executing the computer program.

4. 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 claim 1 is implemented.

Citation Information

Patent Citations

  • Miao nationality costume image semantic segmentation method

    CN114037833A

  • Multi-head and multi-task maritime buoy and boat target detection method based on task coding

    CN118366003A