Target detection method and model based on injection semantic attention
Patent Information
- Application Number
- CN202410984309.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2044-07-22
AI Technical Summary
但还存在原始图像提供的语义信息较少,单个特征层的信息不够充分的问题,低层特征图能呈现目标位置但语义信息相对稀缺,高层特征图语义信息丰富但不准确,导致网络难以完全学习到目标的特征信息,存在识别准确性不足的问题
[0030]本发明通过对输入图像进行基础特征提取和语义特征提取,可以更准确地提取图像中的局部和语义特征;利用多尺度特征金字塔,能够同时考虑不同尺度的特征,有助于检测不同大小的目标;通过编码器和解码器的残差连接,可以更好地利用不同尺度的语义信息,提高特征的表达能力;混合注意力机制能够同时关注特征图中的通道和空间信息,进一步提升特征的利用效率;对检测结果进行非极大值抑制处理,提高了检测结果的准确度。
Smart Images

Figure CN119091181B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of object detection technology, specifically relating to an object detection method based on injected semantic attention. Background Technology
[0002] In recent years, with the rapid development of artificial intelligence technology, computer vision has been widely applied in various fields such as autonomous driving, security monitoring, and robotics. Object detection is an important research direction in computer vision, and its performance directly affects the performance of subsequent tasks such as object tracking, action recognition, and behavior understanding. Traditional object detection methods often face challenges in accuracy and efficiency when dealing with complex scenes such as pedestrian detection. With the rapid development of GPU computing power and deep learning algorithms, object detection has continuously evolved, introducing deep learning-based detection methods, including those using attention mechanisms to enhance feature representation. However, problems still exist, such as the limited semantic information provided by the original image and insufficient information from a single feature layer. Low-level feature maps can represent the target location but lack semantic information, while high-level feature maps have rich but inaccurate semantic information, making it difficult for the network to fully learn the target's feature information, resulting in insufficient recognition accuracy. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a target detection method based on injected semantic attention with high detection accuracy and precision.
[0004] The technical solution adopted to solve the above-mentioned technical problems is: a target detection method based on semantic attention injection, which includes the following steps:
[0005] Step 1. Preprocessing the target dataset
[0006] Obtain the target dataset, and perform scaling and image enhancement processing on the images in the dataset to obtain the target detection dataset;
[0007] Step 2. Obtain multi-scale basic feature maps and semantic feature maps.
[0008] The images to be detected in the target detection dataset are processed by feature extraction at different scales to obtain basic feature maps at the first to fifth scales. The deep basic feature maps at the first to third scales are selected and processed by additional convolutional layers to obtain multi-scale target basic feature maps.
[0009] Simultaneously, the images to be detected in the object detection dataset are processed by a position-aware mask attention module and a convolutional layer to obtain target semantic feature maps at the first to third scales.
[0010] Step 3. Feature fusion to obtain a global feature fusion map
[0011] The multi-scale target base feature map and the target semantic feature map are fused through an attention injection mechanism to obtain a feature fusion map. The feature fusion map is then processed by convolution and batch normalization to obtain a global target feature fusion map.
[0012] The attention injection mechanism is as follows:
[0013] Zi,c(x)=Conv{(1+Si,c(x))*Fi,c(x)}
[0014] In the formula, Zi,c(x) is the global target feature fusion map, i is the feature space location, c is the index of the feature channel, S(x) is the attention information of the semantic information feature, with a value range of [0,1], Fi,c(x) is the multi-scale basic feature map, x is the feature, and Conv{} is the convolution process.
[0015] Step 4. Decode the global target feature fusion map to obtain the target detection result.
[0016] The global target feature fusion map is decoded, the bounding box coordinates of the global target feature fusion map are mapped back to the original image scale, and the bounding box position is adjusted by a loss function to obtain the adjusted target feature map.
[0017] The confidence loss and classification loss are used to determine the object type and confidence level in the bounding box, and preliminary detection results are obtained.
[0018] Non-maximum suppression is applied to the detection results to remove redundant bounding boxes, ultimately yielding the target detection results.
[0019] As a preferred technical solution, the method for the joint processing of the position-aware mask attention module and the convolutional layer in step 2 is as follows: the image to be detected is downsampled at different scales to obtain downsampled feature maps at the first to third scales. The third scale feature map is downsampled to obtain a fourth scale feature map. The fourth scale feature map is upsampled to obtain a fifth scale upsampled feature map. The fifth scale upsampled feature map is upsampled to obtain a sixth scale upsampled feature map. The sixth scale upsampled feature map is upsampled to obtain a seventh scale upsampled feature map. The downsampled first, second, and third scale feature maps are fused with the upsampled fifth, sixth, and seventh scale feature maps through residual connection processing. The low-resolution, semantically strong features are combined with the high-resolution, semantically weak features to obtain a semantic feature map.
[0020] As a preferred technical solution, in step 3, when the scale of the semantic feature map is inconsistent with that of the multi-scale basic feature map, the scale of the semantic feature map is adjusted to the scale of the multi-scale basic feature map.
[0021] A target detection model based on semantic attention injection is provided, which consists of a basic target feature extraction module, a semantic target feature extraction module, a feature distribution space alignment module, a semantic attention injection module, and a result generation module.
[0022] The basic feature extraction module is used to extract the basic features of the target in the image to be detected, and obtain the target basic feature map;
[0023] The semantic feature extraction module is used to extract the target semantic features of the image to be detected, and obtain the target semantic feature map;
[0024] The feature distribution space alignment module is used to adjust the spatial structure of the target basic feature map and the target semantic feature map to be consistent.
[0025] The semantic injection attention module is used to inject the target semantic feature map into the target basic feature map through an attention mechanism to obtain a global target feature fusion map;
[0026] The result generation module uses a classifier to classify and regress the target bounding box, generating target detection results.
[0027] As a preferred technical solution, the basic feature extraction module consists of a convolutional network module and a pooling module. The convolutional network module performs spatial convolution on the input image and extracts local target features to obtain an initial target feature map. The pooling module performs multiple sampling rate operations on the initial target feature map to extract feature information of different scale regions as a multi-scale feature pyramid, and selects the last three scales as the basic target feature map.
[0028] As a preferred technical solution, the semantic feature extraction module consists of an encoder and a decoder. The encoder performs spatial convolution on the input image through convolution operations to extract the target features of the image at that layer and obtain target semantic feature maps at different scales. The decoder maps the target semantic feature maps back to the spatial structure of the original image. At the same time, the target semantic feature maps in the encoder and the corresponding feature maps in the decoder are subjected to residual connection processing, so that the decoder can use semantic feature information at different scales to form a semantic feature pyramid.
[0029] The beneficial effects of this invention are as follows:
[0030] This invention extracts local and semantic features from the input image more accurately by performing basic and semantic feature extraction. Utilizing a multi-scale feature pyramid, it considers features at different scales simultaneously, aiding in the detection of targets of varying sizes. Through residual connections between the encoder and decoder, it better utilizes semantic information at different scales, improving feature expressiveness. A hybrid attention mechanism simultaneously focuses on channel and spatial information in the feature map, further enhancing feature utilization efficiency. Non-maximum suppression processing of the detection results improves the accuracy of the detection.
[0031] This invention has good flexibility and adaptability, and can be adapted to different image and target detection tasks. Attached Figure Description
[0032] Figure 1 This is a flowchart illustrating the target detection method based on injected semantic attention of the present invention.
[0033] Figure 2 This is a schematic diagram of the feature injection operation process.
[0034] Figure 3 This is a diagram of the semantic injection attention target detection network structure. Detailed Implementation
[0035] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments, but the present invention is not limited to the following embodiments.
[0036] exist Figure 1 The target detection method based on injected semantic attention in this embodiment includes the following steps:
[0037] Step 1. Preprocessing the target dataset
[0038] Obtain the target dataset, and perform scaling and image enhancement processing on the images in the dataset to obtain the target detection dataset;
[0039] Step 2. Obtain multi-scale basic feature maps and semantic feature maps.
[0040] The images to be detected in the target detection dataset are processed by feature extraction at different scales to obtain basic feature maps at the first to fifth scales. The deep basic feature maps at the first to third scales are selected and processed by additional convolutional layers to obtain multi-scale target basic feature maps.
[0041] Simultaneously, the images to be detected in the object detection dataset are processed by a position-aware mask attention module and a convolutional layer to obtain target semantic feature maps at the first to third scales.
[0042] The method for joint processing of the position-aware mask attention module and the convolutional layer is as follows: the image to be detected is downsampled at different scales to obtain downsampled feature maps at the first to third scales. The third scale feature map is downsampled to obtain the fourth scale feature map. The fourth scale feature map is upsampled to obtain the fifth scale upsampled feature map. The fifth scale upsampled feature map is upsampled to obtain the sixth scale upsampled feature map. The sixth scale upsampled feature map is upsampled to obtain the seventh scale upsampled feature map. The downsampled first, second, and third scale feature maps are fused with the upsampled fifth, sixth, and seventh scale feature maps through residual connection processing. The low-resolution, semantically strong features are combined with the high-resolution, semantically weak features to obtain the semantic feature map.
[0043] Step 3. Feature fusion to obtain a global feature fusion map
[0044] The multi-scale target base feature map and the target semantic feature map are fused through an attention injection mechanism to obtain a feature fusion map. When the scale of the semantic feature map and the multi-scale base feature map are inconsistent, the scale of the semantic feature map is adjusted to the scale of the multi-scale base feature map and then fused. The feature fusion map is then processed by convolution and batch normalization to obtain the global target feature fusion map.
[0045] like Figure 2 The attention injection mechanism is as follows:
[0046] Zi,c(x)=Conv{(1+Si,c(x))*Fi,c(x)}
[0047] In the formula, Zi,c(x) is the global target feature fusion map, i is the feature space location, c is the index of the feature channel, S(x) is the attention information of the semantic information feature, with a value range of [0,1], Fi,c(x) is the multi-scale basic feature map, x is the feature, and Conv{} is the convolution process.
[0048] Step 4. Decode the global target feature fusion map to obtain the target detection result.
[0049] The global target feature fusion map is decoded, the bounding box coordinates of the global target feature fusion map are mapped back to the original image scale, and the bounding box position is adjusted by a loss function to obtain the adjusted target feature map.
[0050] The confidence loss and classification loss are used to determine the object type and confidence level in the bounding box, and preliminary detection results are obtained.
[0051] Non-maximum suppression is applied to the detection results to remove redundant bounding boxes, ultimately yielding the target detection results.
[0052] exist Figure 3 In this embodiment, the target detection model with semantic attention injection consists of a basic target feature extraction module, a semantic target feature extraction module, a feature distribution space alignment module, a semantic attention injection module, and a result generation module.
[0053] The basic feature extraction module is used to extract the basic features of the target in the image to be detected, and obtain the target basic feature map.
[0054] The basic feature extraction module consists of a convolutional network module and a pooling module. The convolutional network module performs spatial convolution on the input image and extracts local target features to obtain an initial target feature map. The pooling module performs multiple sampling rate operations on the initial target feature map to extract feature information from different scale regions as a multi-scale feature pyramid, and selects the last three scales as the basic target feature map.
[0055] The semantic feature extraction module is used to extract the target semantic features of the image to be detected, and obtain the target semantic feature map.
[0056] The semantic feature extraction module consists of an encoder and a decoder. The encoder performs spatial convolution on the input image through convolution operations to extract the target features of the image at that layer and obtain target semantic feature maps at different scales. The decoder maps the target semantic feature maps back to the spatial structure of the original image. At the same time, the target semantic feature maps in the encoder and the corresponding feature maps in the decoder are subjected to residual connection processing, so that the decoder can use semantic feature information at different scales to form a semantic feature pyramid.
[0057] The feature distribution space alignment module is used to adjust the spatial structure of the target basic feature map and the target semantic feature map to be consistent.
[0058] The semantic injection attention module is used to inject the target semantic feature map into the target basic feature map through an attention mechanism to obtain a global target feature fusion map;
[0059] The result generation module uses a classifier to classify and regress the target bounding box, generating target detection results.
Claims
1. A target detection method based on injected semantic attention, characterized in that, Includes the following steps: Step 1. Preprocessing the target dataset Obtain the target dataset and perform scaling and image enhancement processing on the images in the dataset to obtain the target detection dataset; Step 2. Obtain multi-scale basic feature maps and semantic feature maps. The images to be detected in the target detection dataset are processed by feature extraction at different scales to obtain basic feature maps at the first to fifth scales. The deep basic feature maps at the first to third scales are selected and processed by additional convolutional layers to obtain multi-scale target basic feature maps. Simultaneously, the images to be detected in the object detection dataset are processed by a position-aware mask attention module and a convolutional layer to obtain target semantic feature maps at the first to third scales. The method for joint processing of the location-aware mask attention module and the convolutional layer is as follows: the image to be detected is downsampled at different scales to obtain downsampled feature maps at the first to third scales. The third scale feature map is downsampled to obtain a fourth scale feature map. The fourth scale feature map is upsampled to obtain a fifth scale upsampled feature map. The fifth scale upsampled feature map is upsampled to obtain a sixth scale upsampled feature map. The sixth scale upsampled feature map is upsampled to obtain a seventh scale upsampled feature map. The downsampled first, second, and third scale feature maps are fused with the upsampled fifth, sixth, and seventh scale feature maps respectively through residual connection processing. The low-resolution, semantically strong features are combined with the high-resolution, semantically weak features to obtain a semantic feature map. Step 3. Feature fusion to obtain a global feature fusion map The multi-scale target base feature map and the target semantic feature map are fused through an attention injection mechanism to obtain a feature fusion map. The feature fusion map is then processed by convolution and batch normalization to obtain a global target feature fusion map. The attention injection mechanism is as follows: Zi,c(x) = Conv {(1 + Si,c(x)) ∗ Fi,c(x)} In the formula, Zi,c(x) is the global target feature fusion map, i is the feature space location, c is the index of the feature channel, S(x) is the attention information of the semantic information feature, with a value range of [0, 1], Fi,c(x) is the multi-scale basic feature map, x is the feature, and Conv{} is the convolution process; Step 4. Decode the global target feature fusion map to obtain the target detection result. The global target feature fusion map is decoded, the bounding box coordinates of the global target feature fusion map are mapped back to the original image scale, and the bounding box position is adjusted by a loss function to obtain the adjusted target feature map. The confidence loss and classification loss are used to determine the object type and confidence level in the bounding box, and preliminary detection results are obtained. Non-maximum suppression is applied to the detection results to remove redundant bounding boxes, and the final target detection result is obtained.
2. The target detection method based on injected semantic attention according to claim 1, characterized in that, In step 3, if the scale of the semantic feature map is inconsistent with that of the multi-scale basic feature map, the scale of the semantic feature map is adjusted to match that of the multi-scale basic feature map.
3. A target detection system based on injected semantic attention, characterized in that, The target detection system executes the target detection method based on semantic attention injection as described in claim 1. The target detection system consists of a basic feature extraction module, a semantic feature extraction module, a feature distribution space alignment module, a semantic attention injection module, and a result generation module. The basic feature extraction module is used to extract the basic features of the target in the image to be detected, and obtain the target basic feature map; The semantic feature extraction module is used to extract the target semantic features of the image to be detected, and obtain the target semantic feature map; The feature distribution space alignment module is used to adjust the spatial structure of the target basic feature map and the target semantic feature map to be consistent. The semantic injection attention module is used to inject the target semantic feature map into the target basic feature map through an attention mechanism to obtain a global target feature fusion map; The result generation module uses a classifier to classify and regress the target bounding box, generating target detection results.
4. The target detection system based on injected semantic attention according to claim 3, characterized in that, The basic feature extraction module consists of a convolutional network module and a pooling module. The convolutional network module performs spatial convolution on the input image and extracts local target features to obtain an initial target feature map. The pooling module performs multiple sampling rate operations on the initial target feature map to extract feature information from different scale regions as a multi-scale feature pyramid, and selects the last three scales as the basic target feature map.
5. The target detection system based on injected semantic attention according to claim 3, characterized in that, The semantic feature extraction module consists of an encoder and a decoder. The encoder performs spatial convolution on the input image through convolution operations to extract the target features of the image and obtain target semantic feature maps at different scales. The decoder maps the target semantic feature maps back to the spatial structure of the original image. At the same time, the target semantic feature maps in the encoder and the corresponding feature maps in the decoder are subjected to residual connection processing, so that the decoder can use semantic feature information at different scales to form a semantic feature pyramid.
