A monocular three-dimensional target detection method based on a group-based dynamic query distribution algorithm
By employing a group-based dynamic query allocation algorithm and a lightweight instance density extraction network, the problems of dense targets and occlusion in monocular 3D target detection are solved, achieving high recall and stable 3D localization in complex scenarios, thereby improving the safety of autonomous driving and intelligent traffic monitoring.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING UNION UNIVERSITY
- Filing Date
- 2026-02-03
- Publication Date
- 2026-07-21
AI Technical Summary
Existing monocular 3D target detection methods suffer from a mismatch between the number of queries and the density distribution in complex scenes, resulting in insufficient detection accuracy and recall, especially under conditions of dense targets and occlusion.
A group-based dynamic query allocation algorithm is adopted. By finely modeling the instance density distribution, the query ratio and loss weight are dynamically adjusted. Combined with a lightweight instance density extraction network and an underestimation-aware density loss function, the algorithm achieves adaptive allocation of density-aware queries and group-based one-to-many matching, thereby improving the recall and accuracy of 3D object detection.
Under the premise of controllable computational complexity, it significantly improves the recall rate and 3D localization stability of targets obscured by dense traffic flow, reduces the false negative rate, and enhances traffic safety in autonomous driving and intelligent traffic monitoring.
Smart Images

Figure CN121962765B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and deep learning technology, and in particular to a monocular 3D target detection method based on a grouped dynamic query allocation algorithm. Background Technology
[0002] Three-dimensional perception is a fundamental capability for intelligent driving systems to understand the real physical world. Compared to two-dimensional perception, which only works on an image plane, three-dimensional perception can provide information on the true position, scale, and attitude of targets in space. This allows the system to accurately characterize the relative distances, spatial layout, and motion relationships between targets, providing a reliable basis for decisions such as collision warning, path planning, lane changing, and obstacle avoidance control. With the development of technologies such as autonomous driving, intelligent connected transportation, and intelligent security, environmental perception systems need to acquire more accurate three-dimensional position information of targets such as vehicles and pedestrians in complex traffic scenarios. Compared to solutions based on multi-view cameras or LiDAR, three-dimensional target detection methods based on monocular cameras are gradually becoming an important research direction in vehicle-mounted and roadside perception systems due to their low cost, flexible deployment, and less hardware dependence.
[0003] For monocular 3D target detection, existing methods can be broadly classified into two categories: The first category consists of convolutional methods based on anchor boxes or center point priors. These methods typically use deep convolutional neural networks as a foundation, pre-setting anchor boxes, grid cells, or center points at fixed locations in the 2D feature map. For each location, they regress the 2D bounding box, depth, 3D size, and pose of the target, and then combine this with camera imaging geometry to recover the 3D bounding box. For example, M3D-RPN achieves monocular 3D detection by generating a series of 3D anchor boxes on the feature map and regressing their offsets; methods such as SMOKE, MonoDLE, and GUPNet, on the other hand, utilize center points or grids to regress the 3D attributes of the target within single-stage detection frameworks like CenterNet / FCOS, thus achieving end-to-end monocular 3D target detection. These methods have a clear structure and high inference efficiency, but their performance is highly dependent on the design and scale coverage of the anchor box or center point priors. When the target scale distribution in the scene is complex, or when there are severe occlusions and dense targets, the matching between the prior and the real target is prone to instability, leading to an imbalance between positive and negative samples, which in turn limits the detection accuracy and generalization ability.
[0004] To alleviate the problems caused by the aforementioned prior design and scale matching, another type of 3D extended framework inspired by DETR-like object detectors has emerged in recent years. This type of framework completes object modeling and matching by introducing a query mechanism and an encoder-decoder structure. Instead of explicitly pre-setting anchor boxes on feature maps, this method uses a set of learnable object queries to interact with image features. The network automatically learns the correspondence between queries and targets, thus eliminating anchor box design to some extent, simplifying the network structure, and improving the ability to model targets of different scales and layouts. MonoDETR is a representative work in this field, combining a depth-guided Transformer with monocular 3D detection. It adaptively aggregates information on depth and visual features through a set of object queries, achieving end-to-end DETR-style monocular 3D detection. Subsequent works such as SSD-MonoDETR and MonoDGP further improve query initialization, geometric priors, and decoder structures, continuously enhancing detection performance. This type of method achieves good performance in scenarios with moderate object density and appropriate target scale, but it still has some shortcomings in the following aspects: 1. The initial distribution and number of queries are not correlated with the actual number and spatial density of targets in the scene. The number of queries is often fixed, and the initial distribution lacks guidance on dense areas. If a large number of queries are used uniformly to improve the recall rate in complex scenarios, it can easily lead to a waste of computing resources in simple scenarios. If a small number of queries are used uniformly, it can easily lead to insufficient queries and difficulty in covering all targets in dense and congested scenarios.
[0005] 2. Although some works have introduced the idea of group-based one-to-many matching, which increases the number of positive samples during training by dividing queries into multiple groups, the composition of queries between groups is mostly a simple copy. There is no explicit distinction between which queries should be used in high-density areas and which queries should be used for free exploration. The composition of queries within a group lacks a corresponding relationship with the spatial density of targets in the scene.
[0006] To address the aforementioned technical shortcomings, a novel monocular 3D target detection method based on a grouped dynamic query allocation algorithm is urgently needed. This method should include the following functions: extracting and enhancing features from monocular images, and lightweightly and precisely characterizing instance spatial density based on shallow enhanced features; adaptively adjusting loss weights according to the degree of density underestimation to correct underestimation and missed detections in dense regions; and structurally combining density-aware queries and learnable queries within a grouped one-to-many matching framework, dynamically adjusting their ratio as training progresses to achieve a reasonable balance between prior constraints and free exploration of query resources, and expanding the number of positive samples during training. Summary of the Invention
[0007] To address the problems existing in the prior art, the present invention aims to provide a monocular 3D target detection method based on a group-based dynamic query allocation algorithm. This method achieves dynamic allocation of density-aware queries and dynamic adjustment of query ratios within a group-based one-to-many matching framework by finely modeling instance density distribution, adaptively strengthening constraints on density underestimation, and enabling reasonable allocation of queries according to scene target density. This improves the recall rate and 3D localization accuracy of monocular 3D target detection while keeping computational complexity under control.
[0008] To achieve the above objectives, the present invention provides the following solution: A monocular 3D target detection method based on a grouped dynamic query allocation algorithm includes: The system acquires RGB images captured by a monocular camera, preprocesses the RGB images, performs multi-scale feature extraction and fusion, applies channel-spatial joint attention, and obtains a foreground region probability map. The original features are enhanced and instance density is extracted using the foreground region probability map to obtain an instance density map. This map is then used to obtain a window-level mask using a multiple decay strategy and window max pooling. Based on the window-level mask, dense region windows are marked, and flexible candidates within the dense region windows are retained to generate a density-aware candidate set. A group-based dynamic query allocation algorithm is used to perform group-based dynamic query allocation on the density-aware candidate set to obtain the final query features; the group-based dynamic query allocation algorithm is trained using an uphill training strategy; based on the final query features, the final three-dimensional detection result of the target vehicle is constituted.
[0009] Optionally, obtaining the foreground region probability map includes: The RGB image is preprocessed by scaling and normalization, and the preprocessed image is fed into the pre-trained convolutional neural network backbone and feature pyramid network to obtain a feature map sequence containing multiple scales. The feature map sequence of each layer is sequentially channel-aligned by first target convolution and GroupNorm normalization to construct a top-down multi-scale fusion feature sequence. Channel-spatial joint attention is applied to the multi-scale fusion feature sequence of each layer to obtain attention-enhanced features. The attention-enhanced features are then input into the region segmentation head to obtain the foreground region probability map. During the process of obtaining the foreground region probability map, the foreground region probability map is truncated according to its elements to avoid numerical errors in the subsequent loss function.
[0010] Optionally, constructing the top-down multi-scale fusion feature sequence includes: Linear projection is performed on the deepest feature map sequence to obtain the top-level fusion feature, and the feature map sequences of the remaining layers are fused sequentially from deep to shallow using learnable upsampling to obtain the top-down multi-scale fusion feature sequence.
[0011] Optionally, obtaining the attention enhancement features includes: Adaptive average pooling and adaptive max pooling are performed on the multi-scale fusion feature sequence of each layer to obtain two channel description vectors. These vectors are then fed into a shared multilayer perceptron and added together. The channel attention weight vector is obtained by passing the Sigmoid function, which is used to scale the multi-scale fusion feature sequence in the channel dimension to obtain weighted features. The weighted features are averaged and maximized in the channel dimension, and then concatenated in the channel dimension. The resulting features are further processed through a target convolutional layer and a sigmoid function to obtain a spatial attention map. This map is used to scale the channel attention-weighted features in the spatial dimension and then connected via residuals to obtain the attention-enhanced features.
[0012] Optionally, obtaining the instance density map includes: The foreground region probability map is used to enhance the feature map sequence at multiple scales to obtain a multi-scale region enhanced feature map, namely a shallow high-resolution enhanced feature map. The shallow high-resolution enhancement features are input into the instance density extraction network to obtain the instance density map; the instance density extraction network is trained using the underestimation perceptual density loss function. The instance density extraction network utilizes three depthwise separable convolutions to extract features from the shallow high-resolution enhanced features by increasing the dilation rate layer by layer, thereby obtaining an intermediate feature map. The intermediate feature map is then subjected to a second target convolution, batch normalization, and ReLU activation function, followed by a third target convolution to output a single-channel feature map, which is then activated by Sigmoid to obtain the instance density map.
[0013] Optionally, the underestimation of sensing density loss function includes: Based on the two-dimensional bounding box of each target vehicle in the training samples, the two-dimensional bounding box is converted into center coordinates and width and height. On a grid with the same resolution as the predicted density map, a two-dimensional Gaussian kernel is constructed with the target center as the mean and the standard deviation proportional to the width and height. The Gaussian response of each target is then superimposed to obtain a continuous real instance density map. By combining the actual density and predicted density of each pixel location in the continuous real instance density map with the underestimation penalty coefficient, the underestimation perception weight is obtained. The pixel-level error is then weighted and averaged using the underestimation perception weight to obtain the underestimation perception density loss function.
[0014] Optionally, generating the density-aware candidate set includes: The multi-scale region enhancement feature map and segmentation embedding mask are input into the two-dimensional Transformer encoder to obtain the spliced memory feature sequence and the corresponding spatial shape and position encoding. The memory feature sequence is input into the linear classification head and the bounding box regression head to predict the class score and two-dimensional bounding box parameters in the form of center point for each feature location, and then converted into a normalized set of candidate boxes in the form of target. The candidate scores of each image are sorted from high to low. The first number of candidate boxes with the highest target are selected as the initial candidate set, the second number of candidate boxes with the highest target are defined as core candidates, and the remaining candidate boxes are defined as flexible candidates. Using the instance density map, a binary density mask is generated by setting a threshold and using a multiple decay strategy. Then, window-level mask is obtained by window max pooling, which is used to mark dense region windows. The center point of the flexible candidate is mapped to the corresponding window, and only the flexible candidates falling within the dense region window are retained. At the same time, the local density value is sampled at the center position of the candidate box based on the instance density map. A separate IoU suppression threshold is calculated for each candidate box. A high IoU suppression threshold is used in dense regions to retain multiple nearest neighbor targets, and a low IoU suppression threshold is used in sparse regions to suppress redundancy, thus obtaining the density-aware candidate set.
[0015] Optionally, the grouped dynamic query allocation algorithm includes: The number of preset groups and the number of queries per group are used to extract the feature vectors of the corresponding positions from the encoder memory features using the density-aware candidate set as query content vectors. The coordinates of the query content vectors are then projected into query position vectors through a small multilayer perceptron and spliced together to obtain a density-aware query vector set. The core candidates for the third target quantity are filled in order within each group. If there are flexible candidates after dynamic NMS filtering, they are also placed in the queue. All remaining slots in the group are filled with learnable queries, forming a hybrid query queue that includes density-aware queries and learnable queries. The mixed query queues of all groups are concatenated along the query dimension to obtain a query tensor, which is then input into a two-dimensional Transformer decoder for decoding. The query features of the last layer in the two-dimensional Transformer decoder are then used as the input of a three-dimensional decoder. With the assistance of depth position encoding, three-dimensional bounding box regression is completed, and the ratio is dynamically adjusted through a ramp-up training strategy to obtain the group-based dynamic query allocation algorithm.
[0016] Optionally, dynamically adjusting the ratio through the climbing training strategy includes: ; in, For the number of training rounds, The maximum length of a single density-sensing prefix. For the number of climbing wheels, The number of rounds is The actual value of the single-group density-sensing prefix length.
[0017] Optionally, the final three-dimensional detection result constituting the target vehicle includes: The query features output from the last layer of the 3D decoder in the grouped dynamic query allocation algorithm are mapped through a shared classification head and bounding box regression head. The classification head outputs a probability vector of the query feature belonging to each category, and the bounding box regression head outputs a 6-dimensional real-valued vector. After being added to the corresponding reference point and normalized by Sigmoid, a 6-dimensional normalized box vector is obtained, which is used to characterize the 2D box on the image plane. For the same query feature, a 3D size vector is obtained by mapping through a 3D size regression head, which serves as the scale parameter of the 3D bounding box; The query features are mapped through a deep branch to obtain a 2D depth correlation vector. At the same time, the upper and lower bounding box offsets in the 2D box are normalized to obtain the normalized box height, which is used to obtain the pixel height of the target vehicle in the image. Using the pixel height, the depth estimate of the imaging geometry is determined, and then the residual is introduced into the depth estimate of the imaging geometry. At the same time, the uncertainty parameter in the 2D depth correlation vector is used as the second component to determine the final depth prediction value of the target. The query features are mapped to orientation vectors, the segment with the highest probability in the orientation vectors is selected, and the final orientation angle is obtained by combining the prediction residuals. Based on the two-dimensional center coordinates and the depth prediction value of the final target, the three-dimensional center coordinates are back-projected from the image plane to the camera coordinate system to obtain its three-dimensional center coordinates in space. Combined with the scale parameters of the three-dimensional bounding box, the pixel height, the final depth output vector, and the final orientation angle, the complete three-dimensional bounding box parameters are obtained. Finally, using the category label corresponding to the largest component in the probability vector, the final three-dimensional detection result of the target vehicle is constructed.
[0018] The beneficial effects of this invention are as follows: (1) Improve the recall rate and 3D localization stability of targets occluded by dense traffic flow: This invention constructs a lightweight instance density extraction network on shallow segmentation enhancement features, which can more finely characterize the spatial density distribution of targets within the region and provide more accurate density estimates for partially occluded and densely arranged vehicle regions. On this basis, the query allocation is guided to tilt towards high-density, occluded regions. Compared with schemes that do not model instance density or only rely on the strength of feature responses, this can reduce the false negative rate in dense traffic flow scenarios, and the localization and size prediction of 3D bounding boxes are more stable.
[0019] (2) Targeted suppression of underestimation in occluded areas: The underestimation perception density map loss function proposed in this invention dynamically adjusts the pixel-level loss weights according to the degree of density underestimation, imposing a stronger penalty on areas with high actual density but significantly low prediction, thus explicitly correcting the density underestimation problem in densely occluded areas from the training stage. Compared with traditional static weighting based solely on actual density or using a fixed focus mechanism, this design can more effectively improve the density prediction accuracy of dense traffic flow and severely occluded areas, providing more reliable prior support for subsequent candidate selection and query allocation, thereby further reducing the probability of missed detection of occluded vehicles.
[0020] (3) Achieving a dynamic balance between prior constraints and free exploration in queries: The group-based dynamic query allocation algorithm proposed in this invention allocates density-aware queries to each group query queue in the group-based one-to-many matching, and completes the remaining parts with learnable queries. Combined with a strategy of gradually adjusting the ratio of the two types of queries as the training progresses, the model retains sufficient free exploration capability in the early stage of training, and enhances its dominant role in the later stage of training as the density prior becomes more reliable. This mechanism avoids the waste of computing resources or insufficient query coverage caused by fixed queries or simple copying queries, and makes the spatial distribution of queries more consistent with the target density distribution, achieving more complete and stable 3D modeling of complex occluded scenes.
[0021] (4) Improving overall performance and engineering practicality under controllable computational overhead: The instance density network proposed in this invention adopts lightweight network structures such as depthwise separable convolution, mainly acting on shallow features, with relatively small additional parameters and computational cost; the group-based dynamic query allocation algorithm rearranges the structure within a given total number of queries, improving performance through a more reasonable allocation strategy rather than simply increasing the number of queries. Therefore, without significantly increasing inference time and hardware resource requirements, this invention can significantly improve the recall and robustness of monocular 3D object detection in dense traffic scenarios. Combining the advantages of low cost and flexible deployment of monocular cameras, this invention is beneficial for improving traffic safety in fields such as autonomous driving and intelligent traffic monitoring, and has good social and economic benefits. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart of a monocular 3D target detection method based on a grouped dynamic query allocation algorithm according to an embodiment of the present invention; Figure 2 This is a diagram of the lightweight density extraction network structure according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the group-based dynamic query allocation algorithm according to an embodiment of the present invention; Detailed Implementation The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0025] like Figure 1 As shown, this embodiment discloses a monocular 3D target detection method based on a grouped dynamic query allocation algorithm, including: acquiring RGB images captured by a monocular camera; preprocessing the RGB images and performing multi-scale feature extraction and fusion, and applying channel-spatial joint attention to obtain a foreground region probability map; using the foreground region probability map to enhance the original features and extract instance density to obtain an instance density map, which is used to obtain a window-level mask using a multiple decay strategy and window max pooling; based on the window-level mask, marking dense region windows and retaining flexible candidates within the dense region windows to generate a density-aware candidate set; using a grouped dynamic query allocation algorithm to perform grouped dynamic query allocation on the density-aware candidate set to obtain the final query features; the grouped dynamic query allocation algorithm is trained using an uphill training strategy; and based on the final query features, the final 3D detection result of the target vehicle is constructed.
[0026] Specifically, this embodiment discloses a monocular 3D target detection method based on a grouped dynamic query allocation algorithm, which mainly includes the following steps, wherein each step is sequentially connected and jointly trained through a deep neural network module: (1) Image input and multi-scale feature extraction and region segmentation enhancement: S101, The RGB image captured by the monocular camera is input into the method of the present invention, and preprocessing operations such as scaling and normalization are performed on the image; S102, the preprocessed image is fed into the pre-trained convolutional neural network backbone (VovNetV2-99) and feature pyramid network to obtain a sequence of feature maps containing multiple scales. This multi-scale feature map sequence is denoted as... ,in: Representative feature map, This indicates the specific layer number of the feature map sequence. This represents the total number of feature levels, which is set to 4 in this invention; the first... Feature maps at each scale The size is , This represents the batch size, which is the number of images input at one time. In this invention, it is set to 8. Indicates the number of channels. , They represent the first The height and width of the feature map at each scale.
[0027] S103, for each layer of features The channel-aligned features are obtained by sequentially applying 1×1 convolution and GroupNorm normalization. This process can be expressed as follows: in: Indicates the first The feature map of the layer after channel projection and normalization still has the same size. ; This represents a 1×1 convolution operation; This indicates the GroupNorm normalization operation.
[0028] S104, Constructing a top-down multi-scale fusion feature sequence First, for the deepest feature (the... The layer is directly linearly projected and used as the top-level fusion feature. This process can be represented as: in: Indicates linear projection. This is a top-level integration feature.
[0029] For the remaining levels, fusion is performed sequentially from deep to shallow using learnable upsampling. This process can be represented as: in, Indicates the first The feature map after layer fusion has a size of ; This represents a transpose convolution operation with a stride of 2 and a kernel size of 2×2, where the first... Layer features from Upsampling to the first Same layer The "+" sign indicates element-wise addition, achieving top-down skip-connection fusion. Through the above steps, shallow features can incorporate semantic information from deeper layers while maintaining high resolution.
[0030] S105, apply a channel-space joint attention module (CBAMBlock) to each layer of fused features to obtain attention-enhanced features. This process can be expressed as follows: in, Indicates the first The feature map after layer attention enhancement, size and Consistent; This indicates a module that incorporates both channel attention and spatial attention. The operations performed in these two attention models are as follows: In channel attention, the input features Adaptive average pooling and adaptive max pooling are performed separately to obtain two channel description vectors. These two vectors are then fed into a shared multilayer perceptron and added together. The channel attention weight vector is obtained by passing the sigmoid function, which scales the original features in the channel dimension.
[0031] In spatial attention, the features weighted by channel attention are averaged and maximized along each channel dimension, and then concatenated into a 2-channel feature map. This map is then passed through a convolutional layer with a 7×7 kernel and a sigmoid function to obtain the spatial attention map. The features are scaled along the spatial dimension (position dimension). Finally, residual connections are used to ensure gradient stability and prevent excessive attention from damaging the original features. The residual connection process is as follows: [Equation omitted for brevity]. Indicates the weighted features: S106, in each layer of attention enhancement features The process of outputting a foreground region probability map through a region segmentation head can be represented by the following two formulas: in: and These represent two 3×3 convolution operations with strides of 1 and 2, respectively. It is the ReLU activation function; For the unnormalized foreground score map, when only vehicles are detected, the size is ; The Sigmoid function maps the score to the (0,1) interval. For the first The foreground probability map of the layer, with a size of .
[0032] To avoid this in subsequent loss functions Or the problem of dividing by 0, for Truncation by element can be expressed as follows: in This means restricting the value to a range. Inside.
[0033] S107, the original features are enhanced using the foreground probability map to obtain a multi-scale region enhanced feature map. This process can be expressed as the following formula: in: Indicates the first The enhanced feature map of the layer region has a size of ; This indicates element-wise multiplication (point-by-point multiplication). And because... The shape is , The shape is In implementation, this invention broadcasts along the channel dimension, multiplying each channel by the foreground probability of the corresponding position.
[0034] Among them, shallow high-resolution enhancement features (i.e., the enhanced features of the first scale) can be used as input to the "instance density extraction network based on shallow enhanced features", which can make the instance density extraction network more focused on the dense areas of foreground and target without significantly increasing the amount of computation.
[0035] S108, further providing an explicit foreground mask for downstream modules, this invention uses the foreground probability map of each layer. Binarization with a threshold of 0.5 yields the segmentation embedding mask, a process that can be expressed as follows: in, For the first The binary segmentation embedding mask of the layer has a size of ; Indicates the first Sample ; y and x represent the vertical and horizontal pixel indices of the feature map, respectively.
[0036] The above segmentation embedding mask It can be used as input to the depth prediction module to highlight foreground regions. In the depth prediction module, the segmentation embedding mask is added to the positional encoding to guide the depth prediction to focus on the foreground target region. At the same time, the instance density extraction network directly receives shallow enhancement features as input. These features have been weighted by foreground probability and contain rich foreground information, which can help the network accurately extract the instance density distribution.
[0037] (2) Lightweight instance density extraction network: This invention proposes to apply a lightweight instance density extraction network to shallow enhancement features. The structure includes multiple layers of depth-separable convolutions with holes and a density prediction head: S201, input the shallow enhanced feature map into the feature extraction stage consisting of three layers of depthwise separable convolutions (DSConv). The dilation rates of the three convolutions are 1, 2 and 3 respectively. Each layer contains: 3×3 depthwise convolution (groups equal to the number of channels), 1×1 point convolution, batch normalization and ReLU activation. By increasing the dilation rate layer by layer, the receptive field can be expanded while keeping the number of parameters and computational cost low, and intermediate feature maps can be output.
[0038] S202 sets up a density prediction head based on the intermediate feature map, uses 3×3 convolution, batch normalization and ReLU, and then connects 1×1 convolution to output a single-channel feature map, and obtains an instance density map with a value range of [0,1] through Sigmoid activation; This network performs density modeling and query size estimation with very few parameters, making it suitable for deployment in real-time in-vehicle environments.
[0039] (3) Instance density supervision and underestimation-aware density loss: To train the above density network, this invention introduces an instance density supervision method and designs an underestimation-aware density map loss function based on this: S301: Based on the two-dimensional bounding box of each target vehicle in the training samples, convert it into center coordinates and width and height. On a grid with the same resolution as the predicted density map, construct a two-dimensional Gaussian kernel with the target center as the mean and the standard deviation proportional to the width and height. Then, superimpose the Gaussian response of each target to obtain a continuous real instance density map. S302, for each pixel location in the density map, the true density is denoted as... The predicted density is , Indicates density, This indicates the corresponding annotation value. To represent the model's predicted value, this invention defines the underestimation perception weight as follows: in, This is the underestimation penalty coefficient; the weight increases when the predicted density is lower than the actual density and the underestimation is more severe; the weight is 1 when the predicted density is not lower than the actual density. S303, using this weight, a weighted average of the pixel-level errors is performed to obtain the underestimation of the perceptual density loss, as shown in the following formula: in, Total number of pixels; Through this design, the present invention can exert stronger supervision on areas with underestimated density in areas with high vehicle density and severe mutual occlusion, thereby reducing the missed detection rate of occluded targets from the source.
[0040] (4) Density-aware candidate generation and density-driven dynamic NMS (Non-Maximum Suppression): After completing density modeling, this invention uses encoder features and density information to generate density-aware candidates and performs density-driven dynamic non-maximum suppression: S401 inputs multi-scale enhanced features and masks into a 2D Transformer encoder for encoding, resulting in a spliced memory feature sequence, corresponding spatial shape, and position encoding. Based on the memory features, a linear classification head and a bounding box regression head are used to predict the class score of each feature location and the 2D bounding box parameters in the form of center points (center coordinates and left, right, top, and bottom distances), and converts them into a normalized xyxy form candidate box set. S402, for each image, sort the candidate scores from highest to lowest, and obtain the upper and lower limits related to the query size. The candidates are used as the density prior candidate set, and the previous... One is defined as the core candidate, and the rest are defined as flexible candidates. Less than This is used to ensure coverage of high-confidence targets; S403 utilizes the instance density map output by the density network, generates a binary density mask by setting a threshold and using a multiple attenuation strategy, and then uses window max pooling to obtain a window-level mask to mark dense region windows; the center point of the flexible candidate is mapped to the corresponding window, and only the flexible candidates falling within the dense window are retained, thereby achieving focus on dense traffic flow areas at the candidate level; S404, Sample local density values at the center of the candidate box based on the density map. And calculate a separate IoU (Intersection over Union) suppression threshold for each candidate box, as shown in the following formula: in, The base threshold is set to 0.4 in this invention. The density influence coefficient is set to 0.5 in this invention. Then, candidate boxes are grouped by category, and dynamic NMS (Non-Maximum Suppression) is performed on them according to their scores from highest to lowest. Specifically, when the local density value exceeds the calculated suppression threshold, it indicates that the area is densely populated and spatially crowded, requiring a higher IoU threshold to retain multiple nearby targets and avoid over-suppression; when the local density value is lower than the calculated suppression threshold, it indicates that the area is sparsely populated and spatially dispersed, requiring a lower IoU threshold to effectively suppress redundant detection and improve detection accuracy. This method yields the final density-aware candidate set, retaining at least... One candidate is needed to ensure a recall.
[0041] (5) Group-based dynamic query allocation algorithm and ramp-up training strategy: Based on the existing group-based one-to-many matching idea, this invention proposes a group-based dynamic query allocation algorithm, which structurally combines density-aware queries and learnable queries within a group, and dynamically adjusts the ratio through a ramp-up training strategy: S501, presets the number of groups during the training phase. and the number of queries per group The total number of queries is For each image, using the aforementioned density-aware candidate set, the feature vector of the corresponding position is extracted from the encoder memory features obtained by S401 as the query content vector, and its coordinates are projected into the query position vector through a small multilayer perceptron, and then concatenated to obtain the density-aware query vector set. S502, within each group, fill in the group in order. If there are core candidates and flexible candidates that have passed dynamic NMS, they are also placed in the queue; then, all remaining slots in the group are filled with learnable queries to form a hybrid query queue containing density-aware queries and learnable queries. S503, This invention proposes an uphill training strategy: setting a maximum length for a single group of density-aware prefixes. and number of climbing wheels As the number of training rounds increases Gradually increase according to the formula This process is as follows: The training process begins with a slow ramp-up from 0 to a maximum value. In the early stages of training, learnable queries dominate within each group, preserving a strong capacity for free exploration. As training progresses and density priors become more reliable, the proportion of density-aware queries in each group's queue gradually increases, enhancing the effect of prior constraints and ultimately achieving a balance between "free exploration and prior constraints."
[0042] During the inference phase, the number of groups is set to 1, generating only a single query: several density-aware queries are selected first to fill the prefix region, and any remaining gaps are filled by learnable queries. This reduces computational overhead.
[0043] S504, concatenate the query queues of all groups along the query dimension to obtain a shape of... The query tensor is input into a 2D Transformer decoder for decoding to obtain 2D detection results; then the query features of the last layer of the 2D decoder are used as input to the 3D decoder to complete 3D bounding box regression with the assistance of depth position encoding. (6) Output of 3D attribute regression and detection results: After completing the grouped dynamic query allocation and obtaining the final query features through 2D and 3D decoders, this invention outputs the 3D attributes (including category, 2D bounding box, 3D center, 3D size, depth and orientation) of the target for each query, specifically including the following steps: S601 will output the last layer of the 3D decoder. Each query feature is denoted as a vector. For each Mapping is performed using a shared classification head and bounding box regression head: ① The classification header outputs the probability vectors of which the query belongs to each category. The largest component corresponds to the predicted category and confidence level of the target; ② The bounding box regression head outputs a 6-dimensional real-valued vector. and the corresponding reference point After addition and sigmoid normalization, a 6-dimensional normalized box vector is obtained. The first two dimensions are two-dimensional center-normalized coordinates. The last four dimensions are the normalized bounding box offsets in the up, down, left, and right directions, used to characterize the two-dimensional bounding box on the image plane.
[0044] S602, for the same query feature A 3D size vector is obtained through 3D size regression head mapping. These three-dimensional vectors represent the target's height, width, and length in three-dimensional space, respectively. During training, a three-dimensional size loss is used to constrain its three-dimensional dimensions to approximate those of a real vehicle. During inference, these dimensions are directly used as the scale parameters of the three-dimensional bounding box.
[0045] S603, Regarding query features A 2D depth correlation vector is obtained through deep branch mapping. ,in This is the residual correction amount for geometric depth. This is a scale quantity related to depth uncertainty. The normalized box height can be obtained by normalizing the offsets of the top and bottom bounding boxes in the 2D bounding box. Let the pixel height of the input image be... The pixel height of the target in the image. It can be calculated as follows: Given the camera's horizontal focal length Under the condition of three-dimensional height As a geometric prior, a depth estimate based on imaging geometry can be obtained. , The imaging geometry is represented by the following formula: Then the residual Add to the geometric depth and include the uncertainty parameter As the second component, the final depth output vector is obtained. The final depth output vector is used to assist in locating the target's three-dimensional coordinates in the real world, and its calculation process is as follows: in This is the estimated depth of the target. This reflects the uncertainty of the estimate.
[0046] S604, in the directional branch, query features Mapped to orientation vector The vector can be divided into two parts: ① one part is the probability of several angular segments, which... The system is divided into several sub-intervals, and a probability is given for each interval; the other part is the angular residual within the corresponding segment.
[0047] During training, cross-entropy loss is used for the segmented probabilities, and L1 loss is used for supervision of the angle residuals of the corresponding segments. During inference, the segment with the highest probability is selected first, and then the prediction residual is added to that segment to obtain the final orientation angle. .
[0048] S605, combining the 2D center coordinates with the depth predicted in S603, backprojects the 3D center coordinates from the image plane to the camera coordinate system. Normalized 2D center coordinates. Corresponding pixel coordinates It can be calculated as follows: in , These represent the image width and height, respectively. Let the principal point coordinates in the camera intrinsics be... focal length is , Represents focal length. The center point represents the coordinates of the 3D center in the camera coordinate system. It can be calculated as follows: in, Let x, y, and y be the horizontal axis, vertical axis, and principal optical axis in the camera coordinate system, respectively. Then, for the... A single query can yield complete 3D bounding box parameters. ,in, The dimensions of the object are its length, width, and height, obtained through direct regression of the final query vector. This is combined with the category probability vector. The category label corresponding to the largest component in the matrix can constitute the final 3D detection result of the target.
[0049] S606, In the inference phase, a threshold-based screening is performed on the category confidence of all queries, retaining only queries with a confidence score greater than a preset threshold as candidates. For candidates of the same category with high overlap of 3D bounding boxes, non-maximum suppression based on intersection-union ratio (IUU) is further performed in 3D space to remove redundant detections. The final set of retained 3D bounding boxes is then determined. The corresponding category label and confidence score together serve as the output of monocular 3D object detection. This represents the bounding box, used for subsequent autonomous driving decisions and traffic scene analysis. The output includes the target's 3D position, 3D dimensions, and pose information as the final detection result.
[0050] Through the steps S601 to S606 described above, based on the aforementioned density-aware query generation and grouped dynamic query allocation, this invention generates complete and physically interpretable three-dimensional detection results for each high-quality query, forming a closed-loop reasoning process from monocular images to three-dimensional target attributes.
[0051] In summary, this invention, through the collaborative design of a lightweight density estimation network based on shallow enhancement features, a density loss function that is aware of underestimation, and a grouped dynamic query allocation and ramp-up training strategy, enables the monocular 3D target detection method to achieve adaptive matching of query resources and target density in scenarios with dense traffic flow and severe occlusion. This significantly improves the recall rate and 3D localization accuracy of occluded vehicles while ensuring the overall lightweight nature of the network and inference efficiency.
[0052] like Figure 1 As shown in the figure, this embodiment provides a monocular 3D target detection method based on a grouped dynamic query allocation algorithm, which mainly includes the following steps: 1. Image Input and Multi-Scale Feature Extraction: In this embodiment, the RGB image acquired by the monocular camera is input into the method of this invention: ① Perform preprocessing on the input image, such as scaling and normalization, to obtain an image tensor of uniform size; ② The preprocessed image is fed into the CNN backbone network and feature pyramid network to extract multi-scale feature map sequences. , Representative characteristics, The number of layers representing the features; the sequence includes one shallow high-resolution feature map and three deep semantic feature maps. ③ Channel alignment is performed on features at each scale using 1×1 convolution and normalization to obtain a feature map sequence with a uniform number of channels, which serves as the basic features for subsequent region segmentation enhancement, instance density extraction, and Transformer decoding.
[0053] This step extracts multi-scale features from the original image that combine spatial resolution and semantic information, providing input for subsequent modules. The backbone network uses a pre-trained VovNetV2-99.
[0054] 2. Region Segmentation Enhancement Features: To highlight foreground regions such as vehicles and suppress background interference, this embodiment connects a region segmentation enhancement network in series with the multi-scale features output by the backbone network to perform segmentation enhancement processing on shallow features. The specific process is as follows: Multi-scale features are channel aligned and a top-down fused feature sequence is constructed.
[0055] Feature map sequences output by the backbone network and the feature pyramid network The feature size of each layer is B represents the batch size, and C represents the number of channels, which is set to 256 in this embodiment. Represents height, Represents width, This represents the specific layer number. The region segmentation enhancement network internally applies a 1×1 convolution and GroupNorm to each layer's features for linear projection and normalization, resulting in channel-aligned features; at the deepest layer, it obtains... , Representing the characteristics of integration, This indicates the deepest layer number. For the remaining layers, transposed convolutions are used to perform a 2x learnable upsampling of the fused features from the previous layer, and these features are then element-wise added to the channel-aligned features of the current layer to obtain the fused features for each layer. This process corresponds to step S104 in the technical solution.
[0056] Apply channel-spatial joint attention to the fused features and output a foreground region probability map.
[0057] In each layer of fusion features By applying a channel-space joint attention module, attention-enhanced features are obtained. ,in, This indicates the computation of channel-space joint attention, which corresponds to step S105: Channel attention branch pairs Adaptive average pooling and adaptive max pooling are performed respectively to obtain two channel description vectors. After being summed by a shared 1×1 convolution-ReLU-1×1 convolutional multilayer perceptron, the channel attention weights are obtained by Sigmoid and the features are scaled in the channel dimension. The spatial attention branch performs averaging and maximization on the channel-weighted features along the channel dimension, concatenating them into a 2-channel feature map. This map is then subjected to a 7×7 convolution and a sigmoid function to obtain the spatial attention map. The features are scaled along the spatial location dimension and then added to the input residual to obtain the final result. .
[0058] Attention enhancement features at each layer The region segmentation head outputs a single-channel foreground score map. In this embodiment, the network of the region segmentation head is configured with one 2D convolution + one ReLU activation function + one 2D convolution. Then, a sigmoid function is applied to obtain the foreground region probability map. , To indicate the foreground region, truncate it at... Within the interval, the complete calculation process corresponds to step S106. At this point... Each pixel represents the probability that its corresponding location belongs to the vehicle and its neighboring foreground region.
[0059] Enhance multi-scale features using foreground probability maps.
[0060] For each feature layer, the original features are compared with the foreground probability map. Element-wise multiplication in spatial location yields a multi-scale region-enhanced feature map. , This refers to the aforementioned multi-scale region feature enhancement operation, which corresponds to step S107. Because... The size is , The size is In implementation, broadcasting is performed in the channel dimension, which amplifies the response of each channel at the foreground position and suppresses the response at the background position, thereby improving the distinction between the foreground and the background.
[0061] Generate binary segmentation embeddings and specify shallow enhancement features as input to the density network.
[0062] For each layer of the foreground probability map Binary segmentation embedding masks were obtained by filtering with a threshold of 0.5. This process corresponds to step S108, which is used to explicitly mark the foreground region in subsequent depth prediction and geometric modeling processes.
[0063] In this embodiment, the shallow high-resolution enhancement features and the corresponding shallow segmentation mask are used as inputs to the subsequent instance density extraction network based on the shallow enhancement features. This allows the instance density network to focus on areas with concentrated vehicles and severe occlusion without significantly increasing the computational load, thereby reducing the impact of background noise on density prediction.
[0064] 3. Lightweight instance density extraction network: like Figure 2 As shown, this embodiment enhances features in the shallow region. A lightweight instance density extraction network is built on top of this. Indicates that after regional enhancement, This represents the shallowest layer, used to predict the vehicle spatial density map and query size regression value: Will The input consists of a feature extraction module composed of three concatenated depthwise separable convolutional layers (DSConv), each DSConv layer including: 3×3 depthwise convolutions (groups equal to the number of channels) with dilation rates of 1, 2, and 3 respectively to expand the receptive field; 1×1 pointwise convolutions for channel blending; batch normalization and ReLU activation; and intermediate feature maps obtained after passing through three DSConv layers. , Indicates the specific number of floors.
[0065] In intermediate features Based on this, a density prediction head is set up: a single-channel feature map is output through 3×3 convolution, normalization, and ReLU, followed by 1×1 convolution, and then activated by Sigmoid to obtain a pixel-level instance density map. , Indicates density, This indicates that this is the result of network prediction, used to characterize the spatial density distribution of objects in the image; This network employs depthwise separable convolutions, which have low parameter and computational costs, making it suitable for deployment in real-time systems. It can obtain a relatively fine-grained instance density distribution and query scale prior while ensuring lightweight operation.
[0066] 4. Instance Density Supervision and Underestimation Perceived Density Loss: During the training phase, to learn reliable instance densities, this embodiment constructs a true density map based on the bounding boxes and designs an underestimation perceived density loss: Two-dimensional bounding box for each labeled target Convert to center coordinates and width and height , Represents the horizontal axis. Represents the vertical axis. Indicates the target center. Indicates width, Indicates altitude, in conjunction with On a grid with consistent resolution, The mean, and with A two-dimensional Gaussian kernel is constructed using proportional standard deviations, and the corresponding Gaussian responses are superimposed to obtain a density map of real instances. ; For each pixel location in the density map, let the true density be denoted as . The predicted density is The underestimation perception weight is defined in formula (11), where, This is the underestimation penalty coefficient. The weight increases when the predicted value is lower than the actual density and the underestimation is more severe; otherwise, the weight is 1. The underestimation of perceptual density loss is obtained by weighting the pixel-level error with the weighted sum of squares, as shown in formula (12).
[0067] 5. Density-Aware Candidate Generation and Density-Driven Dynamic NMS: This embodiment generates density-aware candidates based on the encoder output features and combines density information, and then performs density-driven dynamic NMS. ① Enhance features at multiple scales and its mask input 2D Transformer encoder, Indicate the specific layer number to obtain the memory feature sequence. and the corresponding spatial shape information; ② In terms of memory features, the class score is predicted by the linear classification head, the two-dimensional box parameters in the form of center point-edge distance are predicted by the bounding box head, and the normalized xyxy form of candidate box set is converted by combining the pre-calculated grid coordinates. x is the horizontal axis coordinate and y is the vertical axis coordinate. ③ Sort each image by score from highest to lowest, and set... This is the maximum number of dynamically retrieved values. The minimum retention value for dynamic queries is determined based on the upper and lower limits set by the hyperparameters, which determine the total number of candidates. Take the front The first set of candidates is composed of 100 candidates. One as a core candidate, Indicates the maximum quantity. This represents the minimum number, with the rest considered as flexible candidates. ④ Use instance density plot A window-level dense region mask is generated by adaptive threshold binarization and window max pooling. The center of the flexible candidate box is mapped onto the mask, and only flexible candidates falling into the dense window region are retained. ⑤ For each candidate box, sample the local density value at its center position on the instance density map. And calculate the corresponding dynamic IoU suppression threshold, as shown in equation (13); ⑥ Perform NMS based on the dynamic threshold on the candidate boxes according to their scores from high to low, using a higher IoU threshold in dense regions to retain multiple vehicles that are close to each other, and a lower threshold in sparse regions to suppress redundant boxes. The final result is a density-aware candidate set, ensuring that at least one vehicle is retained. One candidate.
[0068] The above steps ensure that the candidate generation process is spatially tilted towards dense, occluded areas, while avoiding excessive searching of open background areas.
[0069] 6. Grouped Dynamic Query Allocation and Climbing Training: One of the core elements of this embodiment is the grouped dynamic query allocation algorithm, such as... Figure 3 As shown, density-aware queries and learnable queries are combined in a grouped one-to-many matching framework, and the ratio of the two is dynamically adjusted as the training process progresses.
[0070] During the training phase, set the number of sets. and the number of queries per group The total number of queries is From the density-aware candidate set, the corresponding memory feature vector is taken as the query content, and its grid coordinates are mapped to the query position through a small perceptron. The vectors are then concatenated to form a density-aware query vector set. For each image, first select the most [images] globally. A density-aware query is used, where M is the maximum prefix length of each group; during the training phase, a hybrid query queue is constructed for each group: Within each group, the front Each query slot is defined as a density-aware prefix region; If the actual density-aware queries obtained by this group are insufficient If there are any, use learnable queries to complete them. One: The remaining query slots are completely filled with learnable queries, resulting in an intra-group query queue containing density-aware queries + learnable queries; Concatenate the query queues of all groups along the query dimension to form a shape like... The query tensor is input into the 2D Transformer decoder, where B is the batch size and C is the number of channels, to obtain the 2D detection results. Then, the query features of the last layer of the 2D decoder are used as the query input of the 3D decoder to regress the 3D position, size and orientation of the vehicle under depth prediction and geometric prior constraints.
[0071] To achieve the process of gradually increasing the proportion of prior constraint queries as prior confidence improves, this embodiment introduces a ramp-up training strategy: the maximum length of a single group of density-aware prefixes is preset to be... The number of climbing wheels is As the number of training rounds e increases, it linearly increases from 0 to... In the early stages of training, most queries within a group are learnable queries, giving the model a strong ability to explore freely. As training progresses, the density prior becomes more reliable, and the proportion of density-aware queries in each group's queue gradually increases, thus achieving a dynamic balance between free exploration and prior constraints.
[0072] 7. Training and Inference Process: Training Phase: Input labeled monocular images and sequentially perform feature extraction, region segmentation enhancement, instance density prediction, density supervision and underestimation perception loss, density-aware candidate generation, grouped dynamic query allocation, and 2D and 3D decoding; the total loss is a weighted sum of density loss, query size regression loss, 2D detection loss, 3D detection loss, etc., and the network parameters are updated through backpropagation.
[0073] Inference stage: Input an unlabeled monocular image, and obtain the final 3D detection result by following the same forward process. Only the 3D position, size and orientation information of the target are retained for downstream decision-making or display.
[0074] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.
Claims
1. A monocular 3D target detection method based on a grouped dynamic query allocation algorithm, characterized in that, include: The system acquires RGB images captured by a monocular camera, preprocesses the RGB images, performs multi-scale feature extraction and fusion, applies channel-spatial joint attention, and obtains a foreground region probability map. The original features are enhanced and instance density is extracted using the foreground region probability map to obtain an instance density map. This map is then used to obtain a window-level mask using a multiple decay strategy and window max pooling. Based on the window-level mask, dense region windows are marked, and flexible candidates within the dense region windows are retained to generate a density-aware candidate set. A group-based dynamic query allocation algorithm is used to perform group-based dynamic query allocation on the density-aware candidate set to obtain the final query features; The group-based dynamic query allocation algorithm is obtained by training using a ramp-up training strategy. Based on the final query features, the final three-dimensional detection result of the target vehicle is constituted; The grouped dynamic query allocation algorithm includes: The number of preset groups and the number of queries per group are used to extract the feature vectors of the corresponding positions from the encoder memory features using the density-aware candidate set as query content vectors. The coordinates of the query content vectors are then projected into query position vectors through a small multilayer perceptron and spliced together to obtain a density-aware query vector set. The core candidates for the third target quantity are filled in order within each group. If there are flexible candidates after dynamic NMS filtering, they are also placed in the queue. All remaining slots in the group are filled with learnable queries, forming a hybrid query queue that includes density-aware queries and learnable queries. The mixed query queues of all groups are concatenated along the query dimension to obtain a query tensor, which is then input into a two-dimensional Transformer decoder for decoding. The query features of the last layer in the two-dimensional Transformer decoder are then used as the input of a three-dimensional decoder. With the assistance of depth position encoding, three-dimensional bounding box regression is completed, and the ratio is dynamically adjusted through an uphill training strategy to obtain the group-based dynamic query allocation algorithm. Dynamically adjusting the ratio through the aforementioned hill-climbing training strategy includes: ; in, For the number of training rounds, The maximum length of a single density-sensing prefix. For the number of climbing wheels, The number of rounds is The actual value of the single-group density-sensing prefix length.
2. The monocular 3D target detection method based on a grouped dynamic query allocation algorithm according to claim 1, characterized in that, Obtaining the foreground region probability map includes: The RGB image is preprocessed by scaling and normalization, and the preprocessed image is fed into the pre-trained convolutional neural network backbone and feature pyramid network to obtain a feature map sequence containing multiple scales. The feature map sequence of each layer is sequentially channel-aligned by first target convolution and GroupNorm normalization to construct a top-down multi-scale fusion feature sequence. Channel-spatial joint attention is applied to the multi-scale fusion feature sequence of each layer to obtain attention-enhanced features. The attention-enhanced features are then input into the region segmentation head to obtain the foreground region probability map. During the process of obtaining the foreground region probability map, the foreground region probability map is truncated according to its elements to avoid numerical errors in the subsequent loss function.
3. The monocular 3D target detection method based on a grouped dynamic query allocation algorithm according to claim 2, characterized in that, Constructing the top-down multi-scale fusion feature sequence includes: Linear projection is performed on the deepest feature map sequence to obtain the top-level fusion feature, and the feature map sequences of the remaining layers are fused sequentially from deep to shallow using learnable upsampling to obtain the top-down multi-scale fusion feature sequence.
4. The monocular 3D target detection method based on the grouped dynamic query allocation algorithm according to claim 2, characterized in that, The attention enhancement features obtained include: Adaptive average pooling and adaptive max pooling are performed on the multi-scale fusion feature sequence of each layer to obtain two channel description vectors. These vectors are then fed into a shared multilayer perceptron and added together. The channel attention weight vector is obtained by passing the Sigmoid function, which is used to scale the multi-scale fusion feature sequence in the channel dimension to obtain weighted features. The weighted features are averaged and maximized in the channel dimension, and then concatenated in the channel dimension. The resulting features are further processed through a target convolutional layer and a sigmoid function to obtain a spatial attention map. This map is used to scale the channel attention-weighted features in the spatial dimension and then connected via residuals to obtain the attention-enhanced features.
5. The monocular 3D target detection method based on a grouped dynamic query allocation algorithm according to claim 1, characterized in that, Obtaining the instance density map includes: The foreground region probability map is used to enhance the feature map sequence at multiple scales to obtain a multi-scale region enhanced feature map, namely a shallow high-resolution enhanced feature map. The shallow high-resolution enhancement features are input into the instance density extraction network to obtain the instance density map; the instance density extraction network is trained using the underestimation perceptual density loss function. The instance density extraction network utilizes three depthwise separable convolutions to extract features from the shallow high-resolution enhanced features by increasing the dilation rate layer by layer, thereby obtaining an intermediate feature map. The intermediate feature map is then subjected to a second target convolution, batch normalization, and ReLU activation function, followed by a third target convolution to output a single-channel feature map, which is then activated by Sigmoid to obtain the instance density map.
6. The monocular 3D target detection method based on the grouped dynamic query allocation algorithm according to claim 5, characterized in that, The underestimation of perception density loss function includes: Based on the two-dimensional bounding box of each target vehicle in the training samples, the two-dimensional bounding box is converted into center coordinates and width and height. On a grid with the same resolution as the predicted density map, a two-dimensional Gaussian kernel is constructed with the target center as the mean and the standard deviation proportional to the width and height. The Gaussian response of each target is then superimposed to obtain a continuous real instance density map. By combining the actual density and predicted density of each pixel location in the continuous real instance density map with the underestimation penalty coefficient, the underestimation perception weight is obtained. The pixel-level error is then weighted and averaged using the underestimation perception weight to obtain the underestimation perception density loss function.
7. The monocular 3D target detection method based on a grouped dynamic query allocation algorithm according to claim 1, characterized in that, Generating the density-aware candidate set includes: The multi-scale region enhancement feature map and segmentation embedding mask are input into the two-dimensional Transformer encoder to obtain the spliced memory feature sequence and the corresponding spatial shape and position encoding. The memory feature sequence is input into the linear classification head and the bounding box regression head to predict the class score and two-dimensional bounding box parameters in the form of center point for each feature location, and then converted into a normalized set of candidate boxes in the form of target. The candidate scores of each image are sorted from high to low. The first number of candidate boxes with the highest target are selected as the initial candidate set, the second number of candidate boxes with the highest target are defined as core candidates, and the remaining candidate boxes are defined as flexible candidates. Using the instance density map, a binary density mask is generated by setting a threshold and using a multiple decay strategy. Then, window-level mask is obtained by window max pooling, which is used to mark dense region windows. The center point of the flexible candidate is mapped to the corresponding window, and only the flexible candidates falling within the dense region window are retained. At the same time, the local density value is sampled at the center position of the candidate box based on the instance density map. A separate IoU suppression threshold is calculated for each candidate box. A high IoU suppression threshold is used in dense regions to retain multiple nearest neighbor targets, and a low IoU suppression threshold is used in sparse regions to suppress redundancy, thus obtaining the density-aware candidate set.
8. The monocular 3D target detection method based on a grouped dynamic query allocation algorithm according to claim 1, characterized in that, The final three-dimensional detection results constituting the target vehicle include: The query features output from the last layer of the 3D decoder in the grouped dynamic query allocation algorithm are mapped through a shared classification head and bounding box regression head. The classification head outputs a probability vector of the query feature belonging to each category, and the bounding box regression head outputs a 6-dimensional real-valued vector. After being added to the corresponding reference point and normalized by Sigmoid, a 6-dimensional normalized box vector is obtained, which is used to characterize the 2D box on the image plane. For the same query feature, a 3D size vector is obtained by mapping through a 3D size regression head, which serves as the scale parameter of the 3D bounding box; The query features are mapped through a deep branch to obtain a 2D depth correlation vector. At the same time, the upper and lower bounding box offsets in the 2D box are normalized to obtain the normalized box height, which is used to obtain the pixel height of the target vehicle in the image. Using the pixel height, the depth estimate of the imaging geometry is determined, and then the residual is introduced into the depth estimate of the imaging geometry. At the same time, the uncertainty parameter in the 2D depth correlation vector is used as the second component to determine the final depth prediction value of the target. The query features are mapped to orientation vectors, the segment with the highest probability in the orientation vectors is selected, and the final orientation angle is obtained by combining the prediction residuals. Based on the two-dimensional center coordinates and the depth prediction value of the final target, the three-dimensional center coordinates are back-projected from the image plane to the camera coordinate system to obtain its three-dimensional center coordinates in space. Combined with the scale parameters of the three-dimensional bounding box, the pixel height, the final depth output vector, and the final orientation angle, the complete three-dimensional bounding box parameters are obtained. Finally, using the category label corresponding to the largest component in the probability vector, the final three-dimensional detection result of the target vehicle is constructed.