Real-time traffic target detection method and system based on adaptive perceptual attention
Through the improved Mobilenetv3 network and adaptive feature pyramid network, combined with adaptive channel attention and perceptual attention modules, the problems of scale variation and redundant detection in traffic target detection are solved, and high-precision and high-reliability traffic target detection is achieved.
Patent Information
- Application Number
- CN202511115125.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-11
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2045-08-11
AI Technical Summary
Existing traffic target detection technology is difficult to dynamically adapt to the dynamic changes and diverse characteristics of targets in traffic scenes, resulting in a decrease in the detection accuracy of small targets and occluded targets. In addition, traditional post-processing algorithms cannot effectively remove redundant detection frames in complex traffic environments, affecting the accuracy and reliability of detection results.
An improved Mobilenetv3 network architecture is constructed, incorporating an adaptive channel attention mechanism, combining an adaptive feature pyramid network and a perceptual attention module. Through multi-scale feature processing and dynamic adjustment, combined with a non-maximum suppression algorithm for traffic flow density and spatial relationship parameters between targets, feature extraction and detection results are optimized.
It significantly improves the accuracy and reliability of traffic target detection in different sizes and complex environments, can more accurately locate and classify traffic targets, and provides efficient traffic target detection support.
Smart Images

Figure CN120599559B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of traffic target detection, and in particular to a real-time traffic target detection method and system based on adaptive perceptual attention. Background Art
[0002] With the rapid development of intelligent transportation systems (ITS), real-time detection of traffic targets, as a core technology in ITS, plays a crucial role in providing fundamental data for key applications such as traffic flow analysis, accident warning, and autonomous driving. In real-world traffic scenarios, targets vary greatly in scale, morphology, and environmental interference. For example, distant vehicles appear smaller in images, while close-up targets such as pedestrians and non-motorized vehicles are rich in detail but easily obscured. Traditional methods and early deep learning detection models are increasingly limited in addressing these challenges, necessitating the urgent need for more advanced and efficient detection technologies.
[0003] Existing traffic object detection technologies face two major challenges. First, at the feature extraction and processing level, most methods employ fixed feature extraction patterns and feature fusion strategies. Both traditional hand-crafted feature extractors and some deep learning-based network models struggle to dynamically adapt to the dynamic changes and diverse feature requirements of objects in traffic scenarios. In complex traffic environments, they are unable to fully exploit and utilize multi-scale feature information, resulting in a significant decrease in detection accuracy for small and occluded objects, and difficulty in achieving balanced detection of traffic objects of varying distances and sizes. Second, in the post-detection processing, traditional post-processing algorithms, such as non-maximum suppression, typically filter out redundant detection frames based on a fixed threshold. This approach fails to consider actual traffic scene parameters such as traffic flow density and spatial relationships between objects. In scenarios with high traffic volume and densely populated objects, it is prone to mistakenly deleting correct detection frames or failing to effectively remove redundant frames. This makes it difficult to ensure the accuracy and reliability of the final detection results, and fails to meet the practical requirements of intelligent transportation systems for high-precision detection. Summary of the Invention
[0004] In order to overcome the shortcomings and deficiencies of the prior art, the present invention provides a real-time traffic target detection method and system based on adaptive perceptual attention.
[0005] A real-time traffic target detection method based on adaptive perceptual attention, the method comprising:
[0006] Step S1: Construct an improved Mobilenetv3 network architecture, which incorporates an adaptive channel attention mechanism. Based on the characteristics of variable object scales and complex features in traffic scenes, the weights of feature maps of different channels are redistributed, thereby filtering out redundant information interference while retaining preset calibration feature information.
[0007] Step S2: Input the traffic video stream data into the improved Mobilenetv3 network, and after multiple layers of depth separation convolution and point-by-point convolution operations, extract the underlying semantic features of the traffic targets to form a preliminary feature map set;
[0008] Step S3: Build an adaptive feature pyramid network to meet the detection requirements of targets of different distances and sizes in traffic scenes. Through inter-level feature fusion and scale adjustment, the feature map set obtained in step S2 is processed at multiple scales to construct a feature pyramid structure with different resolutions and semantic levels.
[0009] Step S4: On the feature maps of each level of the adaptive feature pyramid network, based on the motion parameters, spatial position parameters, and appearance parameters of the traffic target, the adaptive perception attention module calculates the attention weight of each feature area to highlight the feature expression of the area where the traffic target is located;
[0010] Step S5: Based on the weighted feature map obtained in step S4, using the preset detection head structure, perform target frame regression and category prediction operations on the multi-scale feature map to obtain candidate detection frames and corresponding categories of traffic targets;
[0011] Step S6: For the candidate detection frames obtained in step S5, a non-maximum suppression algorithm based on traffic flow density parameters and inter-target spatial relationship parameters is used to remove redundant detection frames and output the final traffic target detection result.
[0012] Furthermore, the adaptive channel attention mechanism of the improved Mobilenetv3 network architecture in step S1 adopts the following calculation method:
[0013] ,
[0014] in, is the input feature map, the dimension is represents the feature map height, represents the feature map width, Indicates the number of channels; is the Sigmoid activation function; It is a multi-layer perceptron structure with two fully connected layers, which is used to perform nonlinear transformation on the channel features after global average pooling. Indicates that a global average pooling operation is performed on the feature map in the spatial dimension; Represents the element-by-element multiplication operation, which is used to allocate weights to different channel features.
[0015] Furthermore, the inter-level feature fusion process of the adaptive feature pyramid network in step S3 satisfies the following relationship:
[0016] ,
[0017] in, After fusion, Layer feature map, Represents the processed feature map of the next layer, Represents an upsampling operation, which is used to adjust the resolution of the feature map of the next layer to be consistent with the current layer; Represents the original Layer feature map, The weight matrix is used for learning, and the feature distribution characteristics of targets of different scales in the traffic scene are used to make weighted adjustments to the original feature map. Through this fusion relationship, the effective integration of features between different levels is achieved.
[0018] Furthermore, in step S4, the adaptive perception attention module determines the attention weight of the motion parameters of the traffic target using the following calculation method:
[0019] ,
[0020] in, represents the attention weight based on motion parameters, For the current traffic target, Target The velocity vector of the motion is Embed, which maps the velocity vector to the high-dimensional feature space. is the learned weight vector used to weight the embedded motion features; is the total number of targets in the current detection area. This calculation method highlights the characteristic expression of the area where the moving target is located.
[0021] Furthermore, in step S4, the adaptive perception attention module determines the attention weight of the appearance parameters of the traffic target using the following calculation method:
[0022] ,
[0023] in, represents the attention weight based on appearance parameters, Target The appearance feature vector of the target image is Feat, which is an appearance feature extraction function used to extract representative appearance features from the target image. is the learned weight vector used to weight the appearance features; is the total number of targets in the current detection area. This calculation method highlights the feature expression of the area where the targets with significant appearance features are located.
[0024] Furthermore, in step S5, when the detection head structure performs target frame regression, the following regression model is adopted in combination with the spatial position parameters of the traffic target:
[0025] ,
[0026] in, To predict the center coordinates of the target box, is the center coordinate of the anchor box, is the width and height of the anchor box, ( ) are the offset and scale factors predicted by the network, The Sigmoid activation function is used to combine the spatial location prior information of traffic targets with the regression model to achieve more accurate target frame prediction.
[0027] Furthermore, the non-maximum suppression algorithm based on the traffic flow density parameter and the inter-object spatial relationship parameter in step S6 adopts the following calculation method:
[0028] ,
[0029] in, For the The score of the candidate detection box, and Respectively and candidate detection boxes, It is the intersection-over-union ratio of two detection frames, which is used to measure the degree of overlap of the detection frames; is the spatial distance between the centers of two detection frames, which is used to measure the spatial relationship between the detection frames; and They are the intersection-and-combination ratio threshold and the spatial distance threshold, which are dynamically adjusted according to the traffic flow density parameter. This calculation method is used to remove redundant detection frames.
[0030] Furthermore, when performing the depth separation convolution operation, the improved Mobilenetv3 network in step S2 uses the following convolution kernel generation method for the local correlation of target features in the traffic scene:
[0031] ,
[0032] in, is the depth separation convolution kernel, is the spatial coordinate of the convolution kernel, and are the number of input and output channels, is the number of local convolution kernels, is the learned weight coefficient, which is used to weight the results of different local convolution kernels; LocalConv is the local convolution operation, For the The receptive field area of the local convolution kernel is dynamically adjusted according to the characteristic distribution characteristics of the traffic target, and more effective underlying semantic features are extracted through this convolution kernel generation method.
[0033] Furthermore, in step S3, the adaptive feature pyramid network adopts the following upsampling and downsampling strategies in combination with the size distribution parameters of traffic targets when performing scale adjustment:
[0034] ,
[0035] in, is the feature map after scale adjustment, is the original feature map, is the upsampling operation, is the downsampling operation, is the size of the feature map, and are the average size and standard deviation obtained from the statistics of traffic target size distribution parameters. This strategy is used to achieve reasonable adjustment of feature maps of different scales.
[0036] Real-time traffic target detection system based on adaptive perceptual attention, including:
[0037] Video data input interaction unit, used to obtain external traffic video stream data and transmit it to the improved Mobilenetv3 feature extraction operation unit;
[0038] An improved Mobilenetv3 feature extraction operation unit is connected to the video data input interaction unit, is used to build an improved Mobilenetv3 network architecture, and performs feature extraction operations on the input traffic video stream data, and outputs an underlying semantic feature map;
[0039] An adaptive feature pyramid construction and integration unit is connected to the improved Mobilenetv3 feature extraction operation unit and is used to build an adaptive feature pyramid network, perform multi-scale processing and inter-level feature fusion on the input underlying semantic feature map, and form a feature pyramid structure;
[0040] An adaptive perceptual attention weight calculation unit is connected to the adaptive feature pyramid construction and integration unit, and calculates the adaptive perceptual attention weight on the feature map of each level of the feature pyramid based on various parameters of the traffic target to obtain a weighted feature map;
[0041] The target detection prediction output unit is connected to the adaptive perception attention weight calculation unit, and uses a preset detection head structure to perform target box regression and category prediction operations on the weighted feature map, and output candidate detection boxes and corresponding categories;
[0042] The detection result optimization and determination unit is connected to the target detection prediction output unit, and uses a non-maximum suppression algorithm based on traffic flow density parameters and spatial relationship parameters between targets to process the candidate detection frame and output the final traffic target detection result.
[0043] Beneficial effects: The present invention proposes a real-time traffic target detection method and system based on adaptive perceptual attention. In terms of feature extraction, the present invention constructs an improved Mobilenetv3 network architecture, incorporates an adaptive channel attention mechanism, redistributes the feature map channel weights according to the characteristics of the traffic scene, effectively filters out redundant information interference, and combines the deep separable convolution kernel generation method designed for the local correlation of traffic target features to greatly improve the effectiveness of underlying semantic feature extraction; the adaptive feature pyramid network fully exploits features of different resolutions and semantic levels through inter-level fusion and dynamic scale adjustment strategies, solving the problem that traditional methods are difficult to evenly detect targets of different sizes. In the post-detection processing link, a non-maximum suppression algorithm based on traffic flow density parameters and spatial relationship parameters between targets dynamically adjusts the screening threshold to accurately remove redundant detection frames and avoid mistakenly deleting correct detection frames. Compared with the traditional fixed threshold method, the accuracy and reliability of the detection results are significantly improved. In addition, the adaptive perceptual attention module calculates the attention weight based on the motion, spatial position and appearance parameters of the traffic target, further highlighting the feature expression of the target area. In conjunction with the target box regression model considering spatial position parameters, more accurate target positioning and category prediction are achieved. This method and system not only effectively overcome the shortcomings of background technologies, but also significantly improve the performance of traffic target detection, providing strong technical support for the efficient operation of intelligent transportation systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 is a flow chart of the method steps of the present invention;
[0045] Figure 2 It is a diagram of the system unit composition of the present invention. DETAILED DESCRIPTION
[0046] It should be noted that, unless there is a conflict, the embodiments in this application and the features described in the embodiments can be combined with each other. The application is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0047] like Figure 1 As shown, a real-time traffic target detection method based on adaptive perceptual attention includes:
[0048] Step S1: Construct an improved Mobilenetv3 network architecture, which incorporates an adaptive channel attention mechanism. Based on the characteristics of variable object scales and complex features in traffic scenes, the weights of feature maps of different channels are redistributed, thereby filtering out redundant information interference while retaining preset calibration feature information.
[0049] Specifically, in traffic scenarios, objects such as vehicles, pedestrians, and traffic signs vary greatly in size, and factors like lighting and weather can make object features complex and variable. To effectively address these situations, an adaptive channel attention mechanism was introduced when constructing the improved Mobilenetv3 network architecture. This mechanism intelligently analyzes each channel of the feature map based on the characteristics of traffic objects. Each channel can be understood as responding to a specific type of information, such as some channels being sensitive to vehicle outlines or others to pedestrian color features. By assigning different weights to these channels, the network focuses on channel information closely related to traffic objects and deemphasizes channels that are more sensitive to redundant information such as background noise, thereby accurately preserving the key features of traffic objects.
[0050] In terms of implementation, the basic architecture of the Mobilenetv3 network is first determined, comprising fundamental modules such as depthwise separable convolutional layers and pointwise convolutional layers. Based on this, the adaptive channel attention module is embedded in an appropriate location in the network, typically between convolutional layers. This module aggregates global information across the spatial dimension of the feature map to obtain a global description of each channel. Next, a nonlinear transformation of this global description is performed using structures such as multilayer perceptrons to learn inter-channel dependencies and generate channel weights. These weights are then element-wise multiplied with the original feature map to reweight the features of different channels and optimize the extraction of traffic target features.
[0051] Step S2: Input the traffic video stream data into the improved Mobilenetv3 network, and after multiple layers of depth separation convolution and point-by-point convolution operations, extract the underlying semantic features of the traffic targets to form a preliminary feature map set;
[0052] Specifically, traffic video stream data contains rich information about traffic scenes, but the raw data cannot be directly used for target detection and requires feature extraction. After the video stream data is input into the improved Mobilenetv3 network frame by frame, the data is sequentially subjected to multiple layers of depthwise separable convolution and pointwise convolution operations. Depthwise separable convolution decomposes traditional convolution operations into depthwise convolution and pointwise convolution. Depthwise convolution performs convolution operations independently on each channel to extract local features within the channel, while pointwise convolution performs cross-channel fusion and dimensionality reduction operations on the features output by the depthwise convolution through 1x1 convolution. The combination of the two can effectively extract the underlying semantic features of traffic targets while significantly reducing the amount of computation.
[0053] During implementation, each convolution operation in the network has specific parameter settings, such as kernel size, number, and stride. These parameters are configured based on the underlying characteristics of traffic targets to accommodate targets of varying scales and shapes. As data flows through the network layers, repeated depthwise separable and pointwise convolution operations gradually extract underlying semantic information, such as edges and textures, from the raw image data. This information is combined to form a preliminary set of feature maps. Each feature map depicts target information in the traffic scene from a different perspective, laying the foundation for subsequent higher-level feature extraction and object detection.
[0054] Step S3: Build an adaptive feature pyramid network to meet the detection requirements of targets of different distances and sizes in traffic scenes. Through inter-level feature fusion and scale adjustment, the feature map set obtained in step S2 is processed at multiple scales to construct a feature pyramid structure with different resolutions and semantic levels.
[0055] Specifically, in traffic scenes, distant objects appear smaller in the image, while nearby objects appear larger. Traditional single-scale features are insufficient for effective detection of all objects. This is where the adaptive feature pyramid network (FN) comes in. Its core function is to perform multi-scale processing on the feature map set obtained in step S2, based on object distance and size differences. Through inter-layer feature fusion and scale adjustment, this network integrates features of different resolutions and semantic levels, enabling it to capture detailed information about small objects while leveraging the global semantic information of larger objects.
[0056] During the implementation, the number of layers in the pyramid network and the initial feature map of each layer are first determined. Feature fusion between layers is achieved through operations such as upsampling and weighted addition. Upsampling is used to adjust the size of the low-resolution feature map to the same size as the high-resolution feature map. Figure 1 The weighted addition method assigns weights to feature maps at different levels based on the importance of traffic targets at different scales before fusing them. At the same time, the feature maps at each level are dynamically rescaled based on the size distribution parameters of traffic targets. Smaller feature maps are upsampled, while larger ones are downsampled. Ultimately, a feature pyramid structure with different resolutions and semantic levels is constructed, providing multi-scale feature representation for subsequent detection.
[0057] Step S4: On the feature maps of each level of the adaptive feature pyramid network, based on the motion parameters, spatial position parameters, and appearance parameters of the traffic target, the adaptive perception attention module calculates the attention weight of each feature area to highlight the feature expression of the area where the traffic target is located;
[0058] Specifically, in traffic scenarios, the target's motion state, spatial position, and appearance characteristics are key information for distinguishing and locating the target. Based on these traffic target parameters, the adaptive perception attention module calculates attention weights on the feature maps at each level of the adaptive feature pyramid network. Motion parameters reflect the target's dynamic behavior, such as direction and speed; spatial position parameters determine the target's specific coordinates within the scene; and appearance parameters include visual features such as the target's color and shape. Through comprehensive analysis of these parameters, the module can determine which areas are the location of traffic targets and assign higher attention weights, thereby enhancing the characteristic expression of the target area and suppressing interference from background and irrelevant areas.
[0059] During implementation, the adaptive perception attention module first analyzes feature maps at each level, extracting information about traffic target motion, spatial location, and appearance. It then uses a specially designed computational mechanism to convert this information into attention weights. For example, for fast-moving targets, the module assigns higher weights to feature regions near their trajectory; for targets with unique appearances, it prioritizes the weights of regions containing their distinctive appearance features. These weights are then calculated with the corresponding feature maps to enhance the characteristic response of the target region, allowing subsequent detection processes to more precisely focus on traffic targets, improving detection accuracy and reliability.
[0060] Step S5: Based on the weighted feature map obtained in step S4, using the preset detection head structure, perform target frame regression and category prediction operations on the multi-scale feature map to obtain candidate detection frames and corresponding categories of traffic targets;
[0061] Specifically, after processing in the previous steps, a weighted feature map highlighting traffic target features is obtained. At this point, the pre-set detection head structure is used to perform target bounding box regression and category prediction on the multi-scale feature map. The goal of target bounding box regression is to determine the specific location and size of traffic targets in the image. By analyzing the target features in the feature map, the target's bounding box coordinates are predicted. Category prediction determines whether the target belongs to a category such as vehicle, pedestrian, or traffic sign, providing accurate target category information for traffic management and decision-making. Multi-scale feature maps provide information at different levels of detail, and the detection head operates at different scales to adapt to the detection needs of targets of varying sizes.
[0062] In practice, the detection head architecture comprises multiple submodules, such as convolutional layers and fully connected layers. These submodules are trained to learn the mapping between traffic target features and the position and category of target bounding boxes. For each scale's weighted feature map, the detection head first extracts further features through convolution. These features are then fed into a fully connected layer for computation, outputting the target bounding box's coordinate offset, size information, and predicted probabilities for each category. Based on these outputs, candidate detection boxes for the traffic target are generated, and the corresponding target category for each detection box is determined, providing the foundation for subsequent screening of accurate final detection results.
[0063] Step S6: For the candidate detection frames obtained in step S5, a non-maximum suppression algorithm based on traffic flow density parameters and inter-target spatial relationship parameters is used to remove redundant detection frames and output the final traffic target detection result.
[0064] Specifically, in step S5, a large number of candidate detection frames are generated, many of which are redundant due to target overlap, detection errors, and other reasons. To obtain accurate detection results, a non-maximum suppression algorithm based on traffic flow density parameters and inter-target spatial relationship parameters is employed. The traffic flow density parameter reflects the density of traffic targets in the current scene, while the inter-target spatial relationship parameter describes the position and overlap relationships between detection frames. Based on these parameters, the algorithm dynamically adjusts the screening rules to accurately determine which detection frames are redundant, thereby removing duplicate and inaccurate detection frames and retaining the detection results that best represent traffic targets.
[0065] When implementing this algorithm, the appropriate IoU threshold and spatial distance threshold are first determined based on traffic density parameters. In scenarios with high traffic density, the IoU threshold is appropriately lowered to avoid mistakenly deleting correct detection frames due to densely packed targets. In scenarios with sparse traffic, the threshold can be increased to more rigorously remove redundant frames. Then, for each candidate detection frame, its IoU and spatial distance with other detection frames are calculated, and judgment is made based on the set threshold. If the IoU of two detection frames exceeds the threshold and the spatial distance is close, the detection frame with the higher score is retained, and the one with the lower score is deleted. Through this screening process, redundant detection frames are gradually removed, ultimately outputting accurate traffic target detection results, providing reliable data support for subsequent applications of intelligent transportation systems.
[0066] Preferably, the adaptive channel attention mechanism of the improved Mobilenetv3 network architecture in step S1 adopts the following calculation method:
[0067] ,
[0068] in, is the input feature map, the dimension is represents the feature map height, represents the feature map width, Indicates the number of channels; is the Sigmoid activation function; It is a multi-layer perceptron structure with two fully connected layers, which is used to perform nonlinear transformation on the channel features after global average pooling. Indicates that a global average pooling operation is performed on the feature map in the spatial dimension; Represents the element-by-element multiplication operation, which is used to allocate weights to different channel features.
[0069] Specifically, the adaptive channel attention mechanism of the improved Mobilenetv3 network architecture in step S1 is calculated. In traffic object detection, different channels in the feature map respond differently to target information, with some channels focusing on the target outline and others on details such as color. This mechanism first performs global average pooling on the input feature map in the spatial dimension, aggregating the feature map in both width and height dimensions to obtain a global feature description for each channel, thereby capturing global information between channels. Next, a multi-layer perceptron consisting of two fully connected layers performs a nonlinear transformation on the global feature description, mining the complex dependencies between channels and generating channel weights. The weights are then mapped to a range between 0 and 1 using a sigmoid activation function to ensure they can be used as scaling coefficients. Finally, the generated weights are element-wise multiplied by the original feature map to weight the features of different channels. This allows the network to focus on channels related to traffic objects and de-emphasize redundant information channels. This redistributes the weights across the feature map channels, improving the targetedness and effectiveness of feature extraction and, consequently, enhancing the network's ability to extract traffic object features.
[0070] Preferably, the inter-level feature fusion process of the adaptive feature pyramid network in step S3 satisfies the following relationship:
[0071] ,
[0072] in, After fusion, Layer feature map, Represents the processed feature map of the next layer, Represents an upsampling operation, which is used to adjust the resolution of the feature map of the next layer to be consistent with the current layer; Represents the original Layer feature map, The weight matrix is used for learning, and the feature distribution characteristics of targets of different scales in the traffic scene are used to make weighted adjustments to the original feature map. Through this fusion relationship, the effective integration of features between different levels is achieved.
[0073] Specifically, in step S3, the feature fusion process between the layers of the adaptive feature pyramid network is carried out. In traffic scenes, targets of different distances and sizes present different resolutions and semantic levels on the feature map, and a single scale feature is difficult to meet the detection requirements. In this fusion relationship, the feature map of the next layer is adjusted to the same resolution as the current layer through an upsampling operation to facilitate feature fusion. The learnable weight matrix weights the original feature map based on the feature distribution characteristics of targets of different scales in traffic scenes, highlighting the features related to the current scale target. By adding the adjusted feature map of the next layer to the original feature map of the current layer, effective integration of features between different layers is achieved. This fusion method enables the network to fully utilize the feature information of different layers, including both the detailed features of the bottom layer and the semantic features of the high layer, forming a multi-scale, multi-level feature expression, thereby adapting to the detection of various targets in traffic scenes and improving the detection performance of targets of different sizes and distances.
[0074] Preferably, in step S4, the adaptive perception attention module determines the attention weight of the motion parameters of the traffic target using the following calculation method:
[0075] ,
[0076] in, represents the attention weight based on motion parameters, For the current traffic target, Target The velocity vector of the motion is Embed, which maps the velocity vector to the high-dimensional feature space. is the learned weight vector used to weight the embedded motion features; is the total number of targets in the current detection area. This calculation method highlights the characteristic expression of the area where the moving target is located.
[0077] Specifically, in step S4, the adaptive perception attention module determines the calculation method of the attention weight based on the motion parameters of the traffic target. The motion state of the traffic target is an important basis for distinguishing and locating the target. The motion parameters include information such as the target's motion speed vector. This calculation method first maps the target's motion speed vector to a high-dimensional feature space through an embedding function, so that the motion features can better participate in subsequent calculations and analysis, and mine the potential information of the motion features. The learnable weight vector weights the embedded high-dimensional motion features to highlight the key motion feature dimensions. Then, using the exponential function and normalization operation, the attention weight based on the motion parameters is calculated. The weight reflects the relative importance of the current target motion feature among all targets in the detection area. By applying this weight to the feature map, the feature expression of the area where the moving target is located can be highlighted, so that the network pays more attention to the moving target during the detection process, improves the detection ability of dynamic targets, and adapts to the motion changes of targets in traffic scenes.
[0078] Preferably, in step S4, the adaptive perception attention module determines the attention weight of the appearance parameters of the traffic target using the following calculation method:
[0079] ,
[0080] in, represents the attention weight based on appearance parameters, Target The appearance feature vector of the target image is Feat, which is an appearance feature extraction function used to extract representative appearance features from the target image. is the learned weight vector used to weight the appearance features; is the total number of targets in the current detection area. This calculation method highlights the feature expression of the area where the targets with significant appearance features are located.
[0081] Specifically, the adaptive perception attention module in step S4 determines the attention weight based on the appearance parameters of the traffic target. The appearance features of traffic targets, such as color, shape, texture, etc., are key factors in identifying targets. This calculation method first extracts a representative appearance feature vector from the target image through an appearance feature extraction function. This vector condenses the core information of the target appearance. The learnable weight vector weights the appearance feature vector to enhance the key appearance features related to target recognition. After the exponential function and normalization operation, the attention weight based on the appearance parameter is obtained. This weight reflects the significance of the appearance feature of the current target among all targets. Applying this weight to the feature map can highlight the feature expression of the area where the target with significant appearance features is located, so that the network can focus more on these targets during detection, improve the recognition accuracy of targets with different appearances, and help to accurately distinguish various types of targets in complex traffic scenes.
[0082] Preferably, when the detection head structure performs target frame regression in step S5, the following regression model is adopted in combination with the spatial position parameters of the traffic target:
[0083] ,
[0084] in, To predict the center coordinates of the target box, is the center coordinate of the anchor box, is the width and height of the anchor box, ( ) are the offset and scale factors predicted by the network, The Sigmoid activation function is used to combine the spatial location prior information of traffic targets with the regression model to achieve more accurate target frame prediction.
[0085] Specifically, in step S5, the detection head structure considers the regression model of the spatial position parameters of the traffic target when regressing the target frame. In traffic target detection, it is crucial to accurately predict the position and size of the target frame. The regression model is based on the anchor frame, and the center coordinates, width and height of the anchor frame are used as prior information. The offset and scale scaling factor predicted by the network are used to adjust the anchor frame so that it fits the real target. The Sigmoid activation function limits the offset to an appropriate range to ensure that the predicted coordinates are reasonable. By combining the prior information of the anchor frame with the network prediction parameters, the center coordinates, width and height of the predicted target frame are calculated. This regression method that combines spatial position prior information utilizes the statistical laws of the position and size of traffic targets in the image to provide a reference basis for target frame prediction. Compared with predictions without prior information, it can more accurately locate the target, reduce prediction bias, and improve the accuracy and reliability of target frame prediction.
[0086] Preferably, the non-maximum suppression algorithm based on the traffic flow density parameter and the inter-target spatial relationship parameter in step S6 adopts the following calculation method:
[0087] ,
[0088] in, For the The score of the candidate detection box, and Respectively and candidate detection boxes, It is the intersection-over-union ratio of two detection frames, which is used to measure the degree of overlap of the detection frames; is the spatial distance between the centers of two detection frames, which is used to measure the spatial relationship between the detection frames; and They are the intersection-and-combination ratio threshold and the spatial distance threshold, which are dynamically adjusted according to the traffic flow density parameter. This calculation method is used to remove redundant detection frames.
[0089] Specifically, the non-maximum suppression algorithm in step S6, based on traffic flow density parameters and inter-object spatial relationship parameters, generates a large number of candidate detection frames after traffic object detection, some of which are redundant. In this algorithm, the intersection-in-union (IoU) ratio measures the degree of overlap between detection frames, and the spatial distance describes the positional relationship between detection frame centers. These two factors are combined to determine the redundancy of detection frames. The IoU and spatial distance thresholds are dynamically adjusted based on the traffic flow density parameter. When traffic flow density is high, the IoU threshold is lowered to avoid mistaken deletion of correct detection frames; when traffic flow is sparse, the threshold is raised to strictly remove redundant frames. For each candidate detection frame, its IoU and spatial distance with other detection frames are calculated. Based on the threshold, detection frames with high scores and meeting the criteria are retained, while redundant frames are removed. This non-maximum suppression algorithm with dynamically adjusted thresholds fully considers the actual traffic scene conditions and can more accurately remove redundant detection frames, avoiding mistaken deletions. This improves the accuracy and reliability of detection results, providing reliable data for subsequent traffic data analysis and decision-making.
[0090] Preferably, when performing the depth separation convolution operation, the improved Mobilenetv3 network in step S2 uses the following convolution kernel generation method for the local correlation of target features in the traffic scene:
[0091] ,
[0092] in, is the depth separation convolution kernel, is the spatial coordinate of the convolution kernel, and are the number of input and output channels, is the number of local convolution kernels, is the learned weight coefficient, which is used to weight the results of different local convolution kernels; LocalConv is the local convolution operation, For the The receptive field area of the local convolution kernel is dynamically adjusted according to the characteristic distribution characteristics of the traffic target, and more effective underlying semantic features are extracted through this convolution kernel generation method.
[0093] Specifically, for the convolution kernel generation method of the improved Mobilenetv3 network deep separable convolution operation in step S2, in traffic scenes, there is local correlation in the features of traffic targets, and the local features of different targets are unique. This convolution kernel generation method generates a deep separable convolution kernel by combining multiple local convolution kernels. Each local convolution kernel has a specific receptive field area, which is dynamically adjusted according to the characteristic distribution characteristics of the traffic target, so that it can better capture the local features of the target. The learnable weight coefficient weights the results of different local convolution kernels to highlight the local convolution results with a high degree of match with the target features. In this way, the generated convolution kernel can extract the underlying semantic features more effectively based on the local correlation of traffic target features. Compared with the fixed convolution kernel, it enhances the network's ability to extract local features of traffic targets, improves the efficiency and quality of feature extraction, and provides more representative underlying features for subsequent target detection.
[0094] Preferably, when the adaptive feature pyramid network in step S3 is performing scale adjustment, the following upsampling and downsampling strategies are adopted in combination with the size distribution parameters of the traffic targets:
[0095] ,
[0096] in, is the feature map after scale adjustment, is the original feature map, is the upsampling operation, is the downsampling operation, is the size of the feature map, and are the average size and standard deviation obtained from the statistics of traffic target size distribution parameters. This strategy is used to achieve reasonable adjustment of feature maps of different scales.
[0097] Specifically, in step S3, the adaptive feature pyramid network considers the scale adjustment strategy of the traffic target size distribution parameters. The targets in the traffic scene vary in size, and the optimal expression scales of targets of different sizes on the feature map are different. This strategy determines the feature map scale adjustment rules based on the average size and standard deviation obtained from the statistics of the traffic target size distribution parameters. For feature maps that are smaller than the average size by a certain standard deviation, upsampling operations are performed to increase the resolution to better capture the details of small targets; for feature maps that are larger than the average size by a certain standard deviation, downsampling operations are performed to reduce the resolution and highlight the global semantic features of large targets; feature maps in the intermediate range remain unchanged. Through this dynamic scale adjustment strategy, the feature pyramid network can adapt to the detection needs of various targets of different sizes in traffic scenes, provide appropriate feature expressions for target detection at different scales, and improve the detection performance and accuracy of targets of different sizes.
[0098] like Figure 2 As shown in FIG, a real-time traffic target detection system based on adaptive perception and attention includes:
[0099] Video data input interaction unit, used to obtain external traffic video stream data and transmit it to the improved Mobilenetv3 feature extraction operation unit;
[0100] An improved Mobilenetv3 feature extraction operation unit is connected to the video data input interaction unit, is used to build an improved Mobilenetv3 network architecture, and performs feature extraction operations on the input traffic video stream data, and outputs an underlying semantic feature map;
[0101] An adaptive feature pyramid construction and integration unit is connected to the improved Mobilenetv3 feature extraction operation unit and is used to build an adaptive feature pyramid network, perform multi-scale processing and inter-level feature fusion on the input underlying semantic feature map, and form a feature pyramid structure;
[0102] An adaptive perceptual attention weight calculation unit is connected to the adaptive feature pyramid construction and integration unit, and calculates the adaptive perceptual attention weight on the feature map of each level of the feature pyramid based on various parameters of the traffic target to obtain a weighted feature map;
[0103] The target detection prediction output unit is connected to the adaptive perception attention weight calculation unit, and uses a preset detection head structure to perform target box regression and category prediction operations on the weighted feature map, and output candidate detection boxes and corresponding categories;
[0104] The detection result optimization and determination unit is connected to the target detection prediction output unit, and uses a non-maximum suppression algorithm based on traffic flow density parameters and spatial relationship parameters between targets to process the candidate detection frame and output the final traffic target detection result.
[0105] A real-time traffic target detection method and system based on adaptive perceptual attention has been developed. This method and system has been optimized in multiple dimensions in the feature extraction process. By improving the Mobilenetv3 network architecture and introducing an adaptive channel attention mechanism, the weights of different channel feature maps can be dynamically allocated based on the characteristics of traffic target scales and complex features, accurately retaining key feature information and discarding redundant interference. At the same time, in the depthwise separable convolution operation, the convolution kernel generation method is dynamically adjusted according to the local correlation of traffic target features, significantly improving the efficiency of underlying semantic feature extraction. The application of the adaptive feature pyramid network, combined with the traffic target size distribution parameters, dynamically adjusts the scale of the feature map and performs weighted fusion between levels, making full use of multi-scale feature information. Whether it is a small target at a long distance or a large target at a close distance, accurate detection can be achieved, effectively solving the problem of imbalance in the detection of targets of different scales in traditional methods.
[0106] In the post-processing stage of target detection, the system adopts a non-maximum suppression algorithm based on traffic flow density parameters and spatial relationship parameters between targets, abandoning the traditional fixed threshold strategy. The screening threshold is dynamically adjusted according to the real-time traffic flow status to accurately judge the overlap degree and spatial relationship between detection frames. This not only avoids the accidental deletion of correct detection frames in target-dense scenes, but also efficiently removes redundant frames, greatly improving the accuracy and reliability of detection results. In addition, the adaptive perception attention module calculates the attention weight based on the motion, spatial position and appearance parameters of traffic targets, and combines the target frame regression model that considers spatial position parameters to further enhance the accuracy of target positioning and category prediction. Through the coordinated operation of each unit, the entire system forms a complete and efficient detection chain from data input to result output, effectively meeting the needs of intelligent transportation systems for real-time and accurate traffic target detection.
[0107] In the description of the present invention, it should be noted that, unless otherwise expressly specified or limited, the terms "disposed," "installed," "connected," "connected," and "fixed" should be understood in a broad sense. For example, they may refer to fixed connections, detachable connections, or integral connections; they may refer to mechanical connections or electrical connections; they may refer to direct connections or indirect connections through an intermediate medium; and they may refer to internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on specific circumstances.
[0108] While embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various equivalent changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.
Claims
1. A real-time traffic target detection method based on adaptive perceptual attention, characterized in that: The method includes: Step S1: Construct an improved Mobilenetv3 network architecture, which incorporates an adaptive channel attention mechanism. Based on the characteristics of variable object scales and complex features in traffic scenes, the weights of feature maps of different channels are redistributed, thereby filtering out redundant information interference while retaining preset calibration feature information. Step S2: The traffic video stream data is input into the improved MobileNetv3 network. After multiple layers of deep separation convolution and point-by-point convolution operations, the underlying semantic features of traffic targets are extracted to form a preliminary feature map set. When performing the deep separation convolution operation, the improved MobileNetv3 network uses the following convolution kernel generation method to analyze the local correlation of target features in the traffic scene: ; in, is the depth separation convolution kernel, is the spatial coordinate of the convolution kernel, and are the number of input and output channels, is the number of local convolution kernels, is the learned weight coefficient, which is used to weight the results of different local convolution kernels; LocalConv is the local convolution operation, For the The receptive field area of the local convolution kernel is dynamically adjusted according to the characteristic distribution characteristics of the traffic target; Step S3: Build an adaptive feature pyramid network to detect targets of different distances and sizes in traffic scenes. By integrating features between layers and adjusting scales, the feature map set obtained in step S2 is processed at multiple scales to construct a feature pyramid structure with different resolutions and semantic levels. When adjusting scales, the adaptive feature pyramid network uses the following upsampling and downsampling strategies in combination with the size distribution parameters of traffic targets: ; in, is the feature map after scale adjustment, is the original feature map, is the upsampling operation, is the downsampling operation, is the size of the feature map, and are the mean size and standard deviation obtained from the statistics of traffic target size distribution parameters; Step S4: On the feature maps of each level of the adaptive feature pyramid network, based on the motion parameters, spatial position parameters, and appearance parameters of the traffic target, the adaptive perception attention module calculates the attention weight of each feature area to highlight the feature expression of the area where the traffic target is located; Step S5: Based on the weighted feature map obtained in step S4, using the preset detection head structure, perform target frame regression and category prediction operations on the multi-scale feature map to obtain candidate detection frames and corresponding categories of traffic targets; Step S6: For the candidate detection frames obtained in step S5, a non-maximum suppression algorithm based on traffic flow density parameters and inter-target spatial relationship parameters is used to remove redundant detection frames and output the final traffic target detection result.
2. The real-time traffic target detection method based on adaptive perceptual attention according to claim 1 is characterized in that: The adaptive channel attention mechanism of the improved Mobilenetv3 network architecture in step S1 adopts the following calculation method: ; in, is the input feature map, the dimension is represents the feature map height, represents the feature map width, Indicates the number of channels; is the Sigmoid activation function; It is a multi-layer perceptron structure with two fully connected layers, which is used to perform nonlinear transformation on the channel features after global average pooling. Indicates that a global average pooling operation is performed on the feature map in the spatial dimension; Represents an element-wise multiplication operation.
3. The real-time traffic target detection method based on adaptive perceptual attention according to claim 1 is characterized in that: The inter-level feature fusion process of the adaptive feature pyramid network in step S3 satisfies the following relationship: ; in, After fusion, Layer feature map, Represents the processed feature map of the next layer, Represents an upsampling operation, which is used to adjust the resolution of the feature map of the next layer to be consistent with the current layer; Represents the original Layer feature map, The weight matrix is used for learning, and the original feature map is weighted and adjusted according to the feature distribution characteristics of targets of different scales in the traffic scene.
4. The real-time traffic target detection method based on adaptive perceptual attention according to claim 1 is characterized in that: In step S4, the adaptive perception attention module determines the attention weight of the motion parameters of the traffic target using the following calculation method: ; in, represents the attention weight based on motion parameters, For the current traffic target, Target The velocity vector of the motion is Embed, which maps the velocity vector to the high-dimensional feature space. is the learned weight vector used to weight the embedded motion features; is the total number of targets in the current detection area.
5. The real-time traffic target detection method based on adaptive perceptual attention according to claim 1 is characterized in that: In step S4, the adaptive perception attention module determines the attention weight of the appearance parameters of the traffic target using the following calculation method: ; in, represents the attention weight based on appearance parameters, Target The appearance feature vector of the target image is Feat, which is an appearance feature extraction function used to extract representative appearance features from the target image. is the learned weight vector used to weight the appearance features; is the total number of targets in the current detection area.
6. The real-time traffic target detection method based on adaptive perceptual attention according to claim 1 is characterized in that: In step S5, the detection head structure uses the following regression model in combination with the spatial position parameters of the traffic target when performing target frame regression: ; in, To predict the center coordinates of the target box, is the center coordinate of the anchor box, is the width and height of the anchor box, ( ) are the offset and scale factors predicted by the network, is the Sigmoid activation function.
7. The real-time traffic target detection method based on adaptive perceptual attention according to claim 1 is characterized in that: The non-maximum suppression algorithm based on the traffic flow density parameter and the inter-target spatial relationship parameter in step S6 adopts the following calculation method: ; in, For the The score of the candidate detection box, and Respectively and candidate detection boxes, It is the intersection-over-union ratio of two detection frames, which is used to measure the degree of overlap of the detection frames; is the spatial distance between the centers of two detection frames, which is used to measure the spatial relationship between the detection frames; and They are the intersection ratio threshold and spatial distance threshold, respectively, which are dynamically adjusted according to the traffic flow density parameter.
8. A system corresponding to the real-time traffic target detection method based on adaptive perceptual attention according to any one of claims 1 to 7, characterized in that: include: Video data input interaction unit, used to obtain external traffic video stream data and transmit it to the improved Mobilenetv3 feature extraction operation unit; An improved Mobilenetv3 feature extraction operation unit is connected to the video data input interaction unit, and is used to construct an improved Mobilenetv3 network architecture, perform feature extraction operations on the input traffic video stream data, and output an underlying semantic feature map; An adaptive feature pyramid construction and integration unit is connected to the improved Mobilenetv3 feature extraction operation unit and is used to build an adaptive feature pyramid network, perform multi-scale processing and inter-level feature fusion on the input underlying semantic feature map, and form a feature pyramid structure; An adaptive perceptual attention weight calculation unit is connected to the adaptive feature pyramid construction and integration unit, and calculates the adaptive perceptual attention weight on the feature map of each level of the feature pyramid based on various parameters of the traffic target to obtain a weighted feature map; The target detection prediction output unit is connected to the adaptive perception attention weight calculation unit, and uses a preset detection head structure to perform target box regression and category prediction operations on the weighted feature map, and output candidate detection boxes and corresponding categories; The detection result optimization and determination unit is connected to the target detection prediction output unit, and uses a non-maximum suppression algorithm based on traffic flow density parameters and spatial relationship parameters between targets to process the candidate detection frame and output the final traffic target detection result.
Citation Information
Patent Citations
Unmanned ship target detection tracking method and system
CN114596335A
Infrared image small target detection method
CN115546500A