A 2.5D vehicle detection method, a terminal device and a storage medium

By constructing a single-stage anchor-based object detection network based on deep learning, the problem of the inability to accurately perceive the position and orientation of vehicles in existing vehicle detection methods is solved, achieving efficient 2.5D vehicle detection, meeting real-time requirements and reducing annotation costs.

CN117671631BActive Publication Date: 2026-11-27CHANGSHA XINGSHEN INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210957048.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-10
Publication Date
2026-11-27
Estimated Expiration
2042-08-10

AI Technical Summary

Technical Problem

Existing 2D and 3D vehicle detection methods suffer from problems such as inability to perceive the true location of targets, high annotation costs, poor generalization, low accuracy of output results, and erroneous association matching when multiple target boxes overlap.

Method used

A single-stage anchor-based object detection network based on deep learning is adopted to construct a multi-task object detection network, including a Backbone network, a Neck feature fusion network, and a DetectionHead detection head. Prediction is performed through multiple detection layers, and the network is trained by combining the SGD optimization method to achieve 2.5D vehicle object detection in monocular images.

Benefits of technology

It achieves image-based 2.5D object detection, which can distinguish the various faces of a vehicle and determine the vehicle's orientation. The prediction time meets the real-time requirements of the vehicle end, reduces annotation costs, and reduces the occurrence of erroneous association matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117671631B_ABST
    Figure CN117671631B_ABST
Patent Text Reader

Abstract

The application discloses a 2.5D vehicle detection method, a terminal device and a storage medium, and the method comprises the following steps: constructing an Anchor-Based multi-task target detection network; training network parameters of the Anchor-Based multi-task target detection network; using the trained Anchor-Based multi-task target detection network to predict a 2D frame of a vehicle target in a to-be-detected image and four corner points of a bottom surface of the vehicle target; and based on a prediction result of the Anchor-Based multi-task target detection network, outputting a position and an orientation of the vehicle target in the to-be-detected image and under a vehicle body coordinate system. The application is used in the field of target detection, can realize monocular image 2.5D vehicle target detection based on a deep learning single-stage Anchor-Based target detection network, and the prediction time can effectively meet real-time requirements of a vehicle end.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of target detection technology, specifically a 2.5D vehicle detection method, terminal equipment, and storage medium. Background Technology

[0002] In the field of intelligent driving, vehicle detection is one of the key tasks to ensure the safe operation of autonomous vehicles. To date, various sensing methods have been used for road vehicle detection, including millimeter-wave radar, lidar, and cameras. With advancements in camera sensing and computing technologies, progress in vehicle detection using monocular vision, stereo vision, and vision-based multi-sensor fusion has become an extremely active research area in the field of intelligent vehicles.

[0003] Currently, image-based vehicle detection methods are mainly divided into two categories: 2D vehicle detection and 3D vehicle detection. 2D vehicle detection uses machine learning or deep learning methods to directly extract the bounding box or rotated bounding box of the vehicle's location from the image. It is commonly used for traffic flow statistics and semantic information from camera-based multi-sensor fusion. 3D vehicle detection uses deep learning methods to detect the vehicle's 3D information in space, including its position, dimensions, and orientation, from a single image or multiple related images (stereo vision, surround view images). It is often used as an input source for autonomous decision-making in intelligent vehicles.

[0004] 2D vehicle detection outputs results in an image coordinate system, failing to perceive the target's true location and unable to identify the vehicle's front, side, rear, and orientation information within a 2D bounding box. 3D vehicle detection training cannot directly acquire 3D samples via camera; it requires LiDAR for data collection and annotation, placing high demands on camera-LiDAR spatiotemporal synchronization and incurring high annotation costs. Furthermore, it exhibits poor generalization during inference, and the low accuracy of the output results leads to low overlap when projecting 3D data back to 2D.

[0005] Therefore, performing 2.5D vehicle detection directly on the image is a compromise. 2.5D vehicle detection means detecting the front, left, right, and rear of the vehicle together with the detected 2D bounding boxes. There are two existing 2.5D detection schemes:

[0006] For a single vehicle target, the method simultaneously detects the overall 2D bounding box of the vehicle and the 2D bounding boxes of its front and rear, and then performs association matching based on their mutual containment relationships. However, this method requires additional annotation of the front and rear of the vehicle during data labeling, increasing the annotation cost; furthermore, this method cannot make judgments when only the side of the vehicle is visible, and it is prone to producing incorrect association matching when multiple target boxes overlap.

[0007] For a vehicle target, the method first detects the overall 2D bounding box of the vehicle, then uses the four corner points of the vehicle's bottom surface as keypoints, and performs keypoint detection within the vehicle's bounding box area. Finally, it infers the vehicle's faces and orientation based on the keypoints. However, this method requires secondary recognition, increasing network complexity and overall latency. Furthermore, data annotation requires labeling visible keypoints, which also presents the problem of erroneous association matching when multiple bounding boxes overlap. Summary of the Invention

[0008] To address the shortcomings of the existing technology, this invention provides a 2.5D vehicle detection method, terminal device, and storage medium, which can achieve 2.5D vehicle target detection in monocular images based on a deep learning single-stage Anchor-Based target detection network.

[0009] To achieve the above objectives, the present invention provides a 2.5D vehicle detection method, comprising the following steps:

[0010] Step 1: Construct an Anchor-Based multi-task object detection network, which consists of three parts: a Backbone network, a Neck feature fusion network, and a DetectionHead detection head.

[0011] The DetectionHead uses multiple detection layers to predict each anchor at each feature scale, wherein the detection layers include:

[0012] Car objectness The detection layer has 1 output channel, indicating that the anchor is the confidence level of the vehicle.

[0013] Car classes The detection layer has N output channels, which represent the confidence scores of each vehicle type label corresponding to the anchor, where N is the total number of defined vehicle types.

[0014] Car box_bias The detection layer has 4 output channels, which represent the x-axis deviation, y-axis deviation, width w-axis deviation, and height h-axis deviation of the target box relative to the Anchor box, respectively.

[0015] Keypoint visibleness The detection layer has 4 output channels, which represent the confidence level of the visibility of four key points of the vehicle target: left rear, right rear, left front, and right front.

[0016] Keypoint pos_biasThe detection layer has 8 output channels, which represent the deviations of the xy coordinates of the four key points of the vehicle target (left rear, right rear, left front, and right front) from the anchor center's xy coordinates.

[0017] Step 2 involves training the network parameters of the Anchor-Based multi-task object detection network. The process is as follows:

[0018] Step 2.1: Read a batch of data, encode the target and preset Anchor in any frame of data within the batch, and obtain the reference multi-task ground truth value of the preset Anchor;

[0019] Step 2.2: Input data from the read batch data is fed into the Anchor-Based multi-task object detection network to obtain the multi-task prediction value for each preset Anchor;

[0020] Step 2.3: Calculate the overall evaluation loss function based on the reference multi-task ground truth and multi-task predicted values ​​of each preset Anchor;

[0021] Step 2.4: The network parameters of the Anchor-Based multi-task object detection network are optimized and trained using the SGD optimization method with impulse. Training is stopped when the number of training rounds exceeds a threshold, and the Anchor-Based multi-task object detection network that minimizes the overall evaluation loss function is output.

[0022] Step 3: The trained Anchor-Based multi-task object detection network is used to predict the 2D bounding box of the vehicle target and the four corner points of the bottom surface of the vehicle target in the test image.

[0023] Step 4: Based on the prediction results of the Anchor-Based multi-task object detection network, output the 2D bounding box of the vehicle target in the image to be tested and the position and orientation in the vehicle coordinate system. The process is as follows:

[0024] Step 4.1, iterate through all preset Anchor A j The predicted output will satisfy the preset Anchor A for the classification score threshold. j The predicted output is stored in the first output target set;

[0025] Step 4.2: Perform non-maximum suppression on the first output target set, and delete the targets in the first output target set whose predicted values ​​are non-maximum and satisfy the overlap threshold, to obtain the first output target set after non-maximum suppression;

[0026] Step 4.4: Calculate the angle θ between each valid target in the first output target set after nonmaximum suppression and the y-axis in the vehicle BEV coordinate system, and store the predicted category, angle θ, center coordinates, width and height of the 2D bounding box of each valid target into the second output target set.

[0027] Step 4.4: Output the second set of output targets, which is the position and orientation of the vehicle target in the 2D bounding box and the vehicle coordinate system in the image to be tested.

[0028] To achieve the above objectives, the present invention also provides a terminal device, comprising:

[0029] Memory, used to store programs;

[0030] A processor is configured to execute the program stored in the memory, and when the program is executed, the processor is configured to perform some or all of the steps of the 2.5D vehicle detection method described above.

[0031] To achieve the above objectives, the present invention also provides a computer-readable storage medium storing computer-executable instructions; when executed by a processor, the computer-executable instructions are used to implement some or all of the steps of the 2.5D vehicle detection method described above.

[0032] Compared with the prior art, the present invention has the following beneficial technical effects:

[0033] 1. Implemented image-based 2.5D object detection, which can distinguish the various faces of a vehicle in an image and determine the vehicle's orientation;

[0034] 2. A monocular 2.5D vehicle target detection is achieved based on a deep learning single-stage Anchor-Based target detection network, and the prediction time can meet the real-time requirements of the vehicle. Attached Figure Description

[0035] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art 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 the structures shown in these drawings without creative effort.

[0036] Figure 1 This is a flowchart of 2.5D target detection in an embodiment of the present invention;

[0037] Figure 2 This is an architecture diagram of the Anchor-Based multi-task object detection network in an embodiment of the present invention;

[0038] Figure 3 This is a structural block diagram of the terminal device in an embodiment of the present invention.

[0039] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0040] 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 a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0041] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indication will also change accordingly.

[0042] Furthermore, in this invention, descriptions involving "first," "second," etc., are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0043] For those skilled in the art, the specific meanings of the above terms in this invention can be understood according to the specific circumstances. Furthermore, the technical solutions of the various embodiments of this invention can be combined with each other, but only on the basis that those skilled in the art can implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.

[0044] like Figure 1 The present embodiment discloses a 2.5D vehicle detection method, which mainly includes the following steps 1-4.

[0045] Step 1: Construct an Anchor-Based Multi-Task Object Detection Network.

[0046] refer to Figure 2 The Anchor-Based Multi-Task Object Detection Network consists of three parts: the Backbone network, the Neck feature fusion network, and the DetectionHead.

[0047] The backbone network consists of EfficientNet-B0, enabling the Anchor-Based multi-task object detection network to balance feature extraction capability and prediction speed. For a detailed implementation of EfficientNet-B0, please refer to "EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks ICML2019"; therefore, it will not be elaborated upon in this embodiment.

[0048] The Neck feature fusion network consists of BiFPN, which achieves simple and fast multi-scale feature fusion. Its output has L feature scales. Compared with the output of the i-th feature scale, the feature map of the (i+1)-th feature scale is half the length and width of the feature map of the i-th feature scale output. For a detailed implementation of BiFPN, please refer to "EfficientDet: Scalable and Efficient Object Detection CVPR 2020", therefore, it will not be described in detail in this embodiment.

[0049] In this embodiment, the DetectionHead uses multiple detection layers to predict each anchor at each feature scale. The detection layers include:

[0050] Car objectness The detection layer consists of a convolutional layer and a sigmoid layer, with 1 output channel, representing the confidence that the anchor is a vehicle, and the value range is [0, 1].

[0051] Car classes The detection layer consists of a convolutional layer and a sigmoid layer, with N output channels, representing the confidence level of the anchor for each vehicle type label, where N is the total number of defined vehicle types.

[0052] Car box_bias The detection layer consists of a single convolutional layer with four output channels, representing the x-axis deviation, y-axis deviation, width w-axis deviation, and height h-axis deviation of the target box relative to the Anchor box, respectively.

[0053] Keypoint visibleness The detection layer consists of a convolutional layer and a sigmoid layer, with 4 output channels, representing the confidence scores of the visibility of four key points of the vehicle target: left rear, right rear, left front, and right front. The value range is [0, 1].

[0054] Keypoint pos_biasThe detection layer consists of a convolutional layer with 8 output channels, representing the deviations of the xy coordinates of the four key points of the vehicle target (left rear, right rear, left front, and right front) from the anchor center's xy coordinates.

[0055] After the DetectionHead performs multi-feature scale predictions, for each detector head, a transform layer is used to concatenate the multi-feature scale predictions equivalent to the preset Anchors, resulting in:

[0056]

[0057] Where Y is the concatenated output; the input X is a five-dimensional vector, with each dimension denoted as (B, K, C, H, W), where B is the number of batch data, K represents the number of preset anchors at a certain position in a 2D feature space, C represents the number of predicted feature maps, H represents the feature map height in the 2D feature space, and W represents the feature map width in the 2D feature space; the transpose(X, (0, 3, 4, 1, 2)) function means to rearrange the input x according to the spatial dimension order (0, 3, 4, 1, 2); the reshape(transpose(X, (0, 3, 4, 1, 2)), (B, A, C)) function means to transform the input transpose(X, (0, 3, 4, 1, 2)) into a three-dimensional vector with a length of (B, A, C) in each dimension, where A = K * H * W; The function represents reshaping(transpose(X, (0, 3, 4, 1, 2)), (B, A, C)) at each feature scale by concatenating the first dimension, where L is the total number of feature scales.

[0058] Step 2 involves training the network parameters of the Anchor-Based multi-task object detection network, which specifically includes the following steps:

[0059] Step 2.1: Read a batch of data, encode the target and preset Anchor in any frame of data within the batch, and obtain the reference multi-task ground truth value of the preset Anchor. The specific implementation process is as follows:

[0060] Step 2.1.1, let It is one of the targets in a frame of data, where G x G represents the x-coordinate of the center of the rectangle containing the target in the image. y G represents the y-coordinate of the center of the bounding box containing the target in the image. w G represents the width of the rectangle containing the target in the image. h This represents the height of the rectangle containing the target in the image. The visible markers of the target's left rear keypoint in the image. This indicates the coordinates of the left rear keypoint of the target on the x-axis of the image. This indicates the coordinates of the left rear keypoint of the target on the y-axis of the image. The visible markers of the target's right rear keypoint in the image. This indicates the coordinates of the right rear keypoint of the target on the x-axis of the image. This indicates the coordinates of the right rear keypoint of the target on the y-axis of the image. The visible markers of the target's left front key point in the image. This indicates the coordinates of the left front keypoint of the target on the x-axis of the image. This indicates the coordinates of the left front keypoint of the target on the y-axis of the image. The visible markers of the target's right front keypoint in the image. This indicates the coordinates of the right front keypoint of the target on the x-axis of the image. This indicates the coordinates of the right front keypoint of the target on the y-axis of the image;

[0061] Step 2.1.2, let It is one of the preset boxes in all the preset Anchors, where, Indicates the default Anchor A j The center is located at the x-axis coordinate of the image. Indicates the default Anchor A j The center is located at the y-axis coordinate of the image. Indicates the default Anchor A j The width of the rectangle in the image. Indicates the default Anchor A j Height of the rectangle in the image.

[0062] Step 2.1.3, for each preset Anchor A j Each target G in this frame of data i Calculate A j With G i The IOU between two rectangles is denoted as the maximum IOU. Wherein, IOU refers to the ratio between the intersection and union of the areas of two rectangles. That is, the larger the IOU, the higher the degree of overlap between the two rectangles.

[0063] Step 2.1.4, set the upper limit threshold of IOU to IOU. max_thre The lower limit threshold for IOU is IOU. min_thre The following encoding operations are performed on the preset Anchor:

[0064] like Greater than or equal to IOU max_threThen the target G i Compared to the preset Anchor A j The encoding of positive samples is denoted as follows:

[0065] Car objectness The output of the detection layer Car objectness =1;

[0066] Car classes The output of the detection layer Car classes =onehot(c), the onehot(c) function constructs a value of length c.

[0067] A vector within the domain, with the c-th element set to 1 and the other elements set to 0;

[0068] Car box_bias Output of the detection layer in, Car box_bias The output of the four output channels of the detection layer;

[0069] Keypoint visibleness Output of the detection layer in, Keypoint visibleness The output of the four output channels of the detection layer;

[0070] Keypoint pos_bias Output of the detection layer

[0071] in, Keypoint pos_bias The output of the 8 output channels of the detection layer.

[0072] like Less than or equal to IOU min_thre Then the target G i Compared to the preset Anchor A j The encoding of the negative sample is denoted as follows:

[0073] Car objectness The output of the detection layer Car objectness =0;

[0074] Car classes The output of the detection layer Car classes =0;

[0075] Car box_bias Output of the detection layer

[0076] Keypoint visibleness Output of the detection layer

[0077] Keypoint pos_bias Output of the detection layer

[0078] like Greater than IOU min_thre And less than IOU max_thre Then the target G i Compared to the preset Anchor A j The encoding of invalid samples is denoted as follows:

[0079] Car objectness The output of the detection layer Car objectness =-1;

[0080] Car classes The output of the detection layer Car classes =0;

[0081] Car box_bias Output of the detection layer

[0082] Keypoint visibleness Output of the detection layer

[0083] Keypoint pos_bias Output of the detection layer

[0084] After encoding is complete, then based on each preset Anchor A j The encoding forms the reference multitasking truth value as follows:

[0085]

[0086] in, For the preset Anchor A j The true confidence value of the vehicle target. For the preset Anchor A j The true value of the vehicle category score, For the preset Anchor A jThe true value of the 2D frame deviation of the vehicle. The true confidence values ​​for key vehicle points. For the preset Anchor A j The true value of the vehicle key point deviation.

[0087] Step 2.2: Input data from the read batch data is fed into the Anchor-Based multi-task object detection network to obtain the multi-task prediction value for each preset Anchor, as follows:

[0088]

[0089] in, For the preset Anchor A j The predicted confidence value of the vehicle target. For the preset Anchor A j Predicted vehicle category score, For the preset Anchor A j Predicted values ​​of vehicle 2D bounding box deviation. The predicted confidence values ​​for key vehicle points. For the preset Anchor A j Predicted values ​​of vehicle key point deviations.

[0090] Step 2.3: Calculate the overall evaluation loss function based on the reference multi-task ground truth and multi-task predicted values ​​for each preset Anchor. Specifically, for each preset Anchor A in the batch data... j ,when When the loss is not equal to -1, calculate the multi-task loss. Then, calculate the overall average loss, i.e., the overall evaluation loss function, by averaging the multi-task losses of all valid preset Anchors. The calculation process is as follows:

[0091] Calculate the vehicle target confidence loss for:

[0092]

[0093] Calculate vehicle category score loss for:

[0094]

[0095] Calculate the vehicle 2D frame deviation loss for:

[0096]

[0097] Calculate the confidence loss of vehicle key points for:

[0098]

[0099] Calculate the vehicle key point deviation loss for:

[0100]

[0101] The number of valid positive samples in the batch data is N. pos With N valid negative samples neg ,for:

[0102]

[0103]

[0104] The overall evaluation loss function L is calculated as follows:

[0105]

[0106] Where BCE(,) represents the BCE loss function, SmoothL1(,) represents the SmoothL1 loss function, and N pos N represents the number of valid positive samples. neg The number of valid negative samples, γ0, γ1, γ2, γ3, and γ4 are proportional coefficients that control the proportion of loss values ​​in each branch.

[0107] Step 2.4: The network parameters of the Anchor-Based multi-task object detection network are optimized and trained using the SGD optimization method with impulse. Training is stopped when the number of training rounds exceeds a threshold, and the Anchor-Based multi-task object detection network that minimizes the overall evaluation loss function is output.

[0108] Step 3: The trained Anchor-Based multi-task object detection network is used to predict the 2D bounding box of the vehicle target and the four corner points of the vehicle target's bottom surface in the test image. In the prediction results, for each preset Anchor A... j The predicted output is:

[0109]

[0110] in:

[0111]

[0112] In the formula, For the preset Anchor A j Output the Bayesian posterior probability of the class.

[0113] Step 4: Based on the prediction results of the Anchor-Based multi-task object detection network, output the 2D bounding box of the vehicle target in the image to be tested and the position and orientation in the vehicle coordinate system. This specifically includes the following steps:

[0114] Step 4.1, iterate through all preset Anchor A j The predicted output will satisfy the preset Anchor A for the classification score threshold. j The predicted output is stored in the first output target set, and the specific implementation process is as follows:

[0115] Step 4.1.1, iterate through all preset Anchor A j The predicted output for each preset Anchor A j Calculate the predicted output, its maximum category classification score, and category index: Where S is The maximum value of the vector, c is The index of the maximum value in the vector is the numerical code of the predicted class. The ArgMax(x) function represents the maximum value and the index of the maximum value of the vector.

[0116] Step 4.1.2, let Object thre As the confidence threshold for the target category, if a certain preset Anchor A j The predicted output of S > Object thre If the target in the second prediction output is a positive sample, then for S > Object... thre Preset AnchorA j The predicted output, decoded by its bounding box coordinates, is:

[0117]

[0118]

[0119]

[0120]

[0121] In the formula, These are the preset Anchor A j Keypoint in the prediction output visibleness Detect the output values ​​of the four output channels of the detection layer;

[0122] Step 4.1.3, let Keypoint thre For key points, there is a confidence threshold; for S > Object thre Preset Anchor A jThe predicted output is processed as follows:

[0123] judge Is it true or false?

[0124] If so, then the default Anchor A is... j The key point to the left rear of the target exists, let's call it... Its coordinates are represented as: right and Perform an inverse perspective transformation to obtain the representation of the left rear key point in the vehicle's BEV coordinate system, denoted as . and

[0125] Otherwise, remember

[0126] judge Is it true or false?

[0127] If so, then the default Anchor A is... j The key point to the right rear of the target exists, record it. Its coordinates are represented as: right and Perform an inverse perspective transformation to obtain the representation of the right rear key point in the vehicle's BEV coordinate system, denoted as . and

[0128] Otherwise, remember

[0129] judge Is it true or false?

[0130] If so, then the default Anchor A is... j The key point on the left front of the target exists, let's call it... Its coordinates are represented as: right and Perform an inverse perspective transformation to obtain the representation of the left front key point in the vehicle's BEV coordinate system, denoted as . and

[0131] Otherwise, remember

[0132] judge Is it true or false?

[0133] If so, then the default Anchor A is... j The key point to the right front of the target exists, record it. Its coordinates are represented as: right and Perform an inverse perspective transformation to obtain the representation of the right front key point in the vehicle's BEV coordinate system, denoted as . and

[0134] Otherwise, remember

[0135] in, For each of the preset Anchor A j Keypoint in the prediction output pos_bias The output values ​​of the eight output channels of the detection layer are detected;

[0136] Let S > Object thre Preset Anchor A j The predicted output corresponds to the target D. i After decoding, it is:

[0137]

[0138] and all D i Add to the first output target set O ori .

[0139] Step 4.2: Perform non-maximum suppression on the first output target set. Targets in the first output target set whose predicted values ​​are non-maximum and satisfy the overlap threshold are deleted, resulting in the first output target set after non-maximum suppression. The specific implementation process of non-maximum suppression can be found in "Fast R-CNN ICCV 2015", therefore it will not be described in detail in this embodiment.

[0140] 10. Step 4.3: Calculate the angle θ between each valid target in the first output target set after non-maximum suppression and the y-axis in the vehicle BEV coordinate system, and store the predicted category, angle θ, center coordinates, width, and height of the 2D bounding box for each valid target into the second output target set. The specific implementation process is as follows:

[0141] For the first output target set O ori All D i Perform the following calculation operation for the included angle θ:

[0142] Let the direction vector of the y-axis in the vehicle's BEV coordinate system be...

[0143] like If only one or more values ​​are 1, then no position estimation is performed, i.e., let θ = NAN;

[0144] like Then the width direction vector According to the right-hand rule, find The orthogonal vector (i.e., the length direction vector) is denoted as but and the direction vector of the y-axis The included angle θ is: in, Represents the width direction vector Projection along the x-axis Represents the width direction vector Projection along the y-axis Represents the length direction vector Projection along the x-axis Represents the length direction vector Projection along the y-axis;

[0145] like Then the width direction vector According to the right-hand rule, find The orthogonal vector (i.e., the length direction vector) is denoted as but and the direction vector of the y-axis The included angle θ is:

[0146] like Then the length direction vector but and the direction vector of the y-axis The included angle θ is:

[0147] like Then the length direction vector but and the direction vector of the y-axis The included angle θ is:

[0148] Where × represents the cross product of vectors, · represents the dot product of vectors, and the sign function represents taking the sign of the input value;

[0149] Let DA be the objective of solving for angle θ. i =(c,S,G x G y G w G h ,θ), DA i Add to the second output target set O pos middle.

[0150] Step 4.4: Output the second set of output targets, which is the position and orientation of the vehicle target in the 2D bounding box and the vehicle coordinate system in the image to be tested.

[0151] refer to Figure 3 This embodiment also provides a terminal device including a transmitter, a receiver, a memory, and a processor. The transmitter is used to send instructions and data, the receiver is used to receive instructions and data, the memory is used to store computer-executed instructions, and the processor is used to execute the computer-executed instructions stored in the memory to implement the various steps performed by the 2.5D vehicle detection method in the above embodiment. Its specific implementation process is the same as the aforementioned 2.5D vehicle detection method.

[0152] It should be noted that the aforementioned memory can be either standalone or integrated with the processor. When the memory is set up independently, the terminal device also includes a bus for connecting the memory and the processor.

[0153] This embodiment also provides a computer-readable storage medium storing computer-executable instructions. When the processor executes the computer-executable instructions, the 2.5D vehicle detection method executed by the terminal device described above is implemented.

[0154] The above description is merely a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural transformations made using the contents of the present invention's specification and drawings under the inventive concept of the present invention, or direct / indirect applications in other related technical fields, are included within the patent protection scope of the present invention.

Claims

1. A 2.5D vehicle detection method, characterized in that, Includes the following steps: Step 1: Construct an Anchor-Based multi-task object detection network, which consists of three parts: a Backbone network, a Neck feature fusion network, and a DetectionHead detection head. The DetectionHead uses multiple detection layers to predict each anchor at each feature scale, wherein the detection layers include: Car objectness The detection layer has 1 output channel, indicating that the anchor is the confidence level of the vehicle. Car classes The detection layer has N output channels, which represent the confidence scores of each vehicle type label corresponding to the anchor, where N is the total number of defined vehicle types. Car box_bias The detection layer has 4 output channels, which represent the x-axis deviation, y-axis deviation, width w-axis deviation, and height h-axis deviation of the target box relative to the Anchor box, respectively. Keypoint visibleness The detection layer has 4 output channels, which represent the confidence level of the visibility of four key points of the vehicle target: left rear, right rear, left front, and right front. Keypoint pos_bias The detection layer has 8 output channels, which represent the deviations of the xy coordinates of the four key points of the vehicle target (left rear, right rear, left front, and right front) from the anchor center's xy coordinates. Step 2: Train the network parameters of the Anchor-Based multi-task object detection network; Step 3: The trained Anchor-Based multi-task object detection network is used to predict the 2D bounding box of the vehicle target and the four corner points of the bottom surface of the vehicle target in the test image. Step 4: Based on the prediction results of the Anchor-Based multi-task object detection network, output the 2D bounding box of the vehicle target in the image to be tested and the position and orientation in the vehicle coordinate system.

2. The 2.5D vehicle detection method according to claim 1, characterized in that, In the Anchor-Based multi-task object detection network, after the DetectionHead performs multi-feature scale prediction, a transform layer is used to concatenate the prediction results at multiple feature scales, resulting in: in, The output is the concatenated data; the input is... It is a five-dimensional vector, with each dimension denoted as . ,in, The number of data in the batch. This represents the preset number of Anchors at a given location in a 2D feature space. This indicates the number of predicted feature maps. Represents the height of the feature map in the 2D feature space. The width of the feature map represents the 2D feature space; The function represents the input Ordered by spatial dimensions Rearrange; The function represents the input Transformed into a three-dimensional vector, with a length of in each dimension. ,in, ; The function represents the output at each feature scale. The components are joined according to the first dimension, where... This represents the total number of feature scales.

3. The 2.5D vehicle detection method according to claim 2, characterized in that, Step 2 specifically includes: Step 2.1: Read a batch of data, encode the target and preset Anchor in any frame of data within the batch, and obtain the reference multi-task ground truth value of the preset Anchor; Step 2.2: Input data from the read batch data is fed into the Anchor-Based multi-task object detection network to obtain the multi-task prediction value for each preset Anchor; Step 2.3: Calculate the overall evaluation loss function based on the reference multi-task ground truth and multi-task predicted values ​​of each preset Anchor; Step 2.4: The network parameters of the Anchor-Based multi-task object detection network are optimized and trained using the SGD optimization method with impulse. Training is stopped when the number of training rounds exceeds a threshold, and the Anchor-Based multi-task object detection network that minimizes the overall evaluation loss function is output.

4. The 2.5D vehicle detection method according to claim 3, characterized in that, In step 2.1, encoding the target and preset Anchor in any frame of data within the batch specifically involves: For each preset Anchor Each target in this frame of data ,calculate and The IOU between two rectangles is denoted as the maximum IOU. ; Let the upper limit threshold of IOU be The lower limit threshold for IOU is : like Greater than or equal to Then the target Compared to the preset Anchor The encoding is denoted as a positive sample; like Less than or equal to Then the target Compared to the preset Anchor The encoding is denoted as a negative sample; like Greater than and less than Then the target Compared to the preset Anchor The encoding of the sample is recorded as invalid.

5. The 2.5D vehicle detection method according to claim 4, characterized in that, In step 2.3, the calculation process of the overall evaluation loss function is as follows: Get each preset Anchor in the batch data The reference multitasking truth value is: in, Preset Anchor The true confidence value of the vehicle target. Preset Anchor The true value of the vehicle category score, Preset Anchor The true value of the 2D frame deviation of the vehicle. The true confidence values ​​for key vehicle points. Preset Anchor The true value of the vehicle key point deviation; Get each preset Anchor in the batch data The multi-task prediction value is: in, Preset Anchor The predicted confidence value of the vehicle target. Preset Anchor Predicted vehicle category score, Preset Anchor Predicted values ​​of vehicle 2D bounding box deviation. Confidence prediction values ​​for vehicle key points Preset Anchor Predicted values ​​of vehicle key point deviations; For each preset Anchor in the batch data When the target Compared to the preset Anchor When the encoded sample is not an invalid sample, the multi-task loss is calculated. Then, the average of the multi-task losses of all valid pre-set Anchors is taken to calculate the overall average loss, i.e., the overall evaluation loss function, which is as follows: Calculate the vehicle target confidence loss ,for: Calculate vehicle category score loss ,for: Calculate the vehicle 2D frame deviation loss ,for: Calculate the confidence loss of vehicle key points ,for: Calculate the vehicle key point deviation loss ,for: Calculate the overall evaluation loss function ,for: in, express loss function express loss function The number of valid positive samples. Number of valid negative samples , , , , This is the proportionality coefficient.

6. The 2.5D vehicle detection method according to any one of claims 1 to 5, characterized in that, In step 3, the prediction results of the Anchor-Based multi-task object detection network, for each preset Anchor... The predicted output is: in: In the formula, Preset Anchor The Bayesian posterior probability of the output class. Preset Anchor The predicted confidence value of the vehicle target. Preset Anchor Predicted vehicle category score, Preset Anchor Predicted values ​​of vehicle 2D bounding box deviation. Confidence prediction values ​​for vehicle key points Preset Anchor Predicted values ​​of vehicle key point deviations.

7. The 2.5D vehicle detection method according to claim 6, characterized in that, Step 4 specifically includes: Step 4.1, iterate through all preset Anchors The predicted output will satisfy the preset Anchor of the classification score threshold. The predicted output is stored in the first output target set; Step 4.2: Perform non-maximum suppression on the first output target set, and delete the targets in the first output target set whose predicted values ​​are non-maximum and satisfy the overlap threshold, to obtain the first output target set after non-maximum suppression; Step 4.3: Calculate the angle between each valid target in the first output target set after non-maximum suppression and the y-axis in the vehicle BEV coordinate system. And the predicted category and angle of each valid target. The center coordinates, width, and height of the 2D bounding box are stored in the second output target set; Step 4.4: Output the second set of output targets, which is the position and orientation of the vehicle target in the 2D bounding box and the vehicle coordinate system in the image to be tested.

8. The 2.5D vehicle detection method according to claim 7, characterized in that, Step 4.1 specifically includes: Traverse all preset Anchors The predicted output for each preset Anchor Calculate the maximum category classification score and category index of the predicted output: ,in, yes The maximum value in a vector. yes The index of the maximum value in the vector corresponds to the numerical code of the predicted class. The function represents the maximum value and the index of the maximum value of the orientation quantity; make For the target category confidence threshold, Preset Anchor The predicted output, decoded by its bounding box coordinates, is: In the formula, The rectangle indicating the target in the image is centered at... The coordinates of the axis, The rectangle indicating the target in the image is centered at... The coordinates of the axis, This represents the width of the rectangle containing the target in the image. This represents the height of the rectangle containing the target in the image. Indicates the default Anchor Center in image The coordinates of the axis, Indicates the default Anchor Center in image The coordinates of the axis, Indicates the default Anchor The width of the rectangle in the image. Indicates the default Anchor The height of the rectangle in the image, , , , Preset Anchors Keypoint in the prediction output visibleness Detect the output values ​​of the four output channels of the detection layer; make For key points, there exists a confidence threshold, let Indicates the visible markers of the target's left rear keypoint in the image. The left rear keypoint of the target is shown in the image. coordinates of the axis The left rear keypoint of the target is shown in the image. coordinates of the axis Indicates the visible markers of the target's right rear keypoint in the image. The right rear keypoint of the target is shown in the image. coordinates of the axis The right rear keypoint of the target is shown in the image. coordinates of the axis The visible markers of the target's left front key point in the image. Indicates the left front key point of the target in the image coordinates of the axis Indicates the left front key point of the target in the image coordinates of the axis The visible markers of the target's right front key points in the image. The target's right front key point is shown in the image. coordinates of the axis The target's right front key point is shown in the image. The coordinates of the axes, for Preset Anchor Predicted output: judge Is it true or false? If so, then the default Anchor The key point to the left rear of the target exists, let's call it... Its coordinates are represented as: 、 ,right and Perform an inverse perspective transformation to obtain the representation of the left rear key point in the vehicle's BEV coordinate system, denoted as . and ; Otherwise, remember , , ; judge Is it true or false? If so, then the default Anchor The key point to the right rear of the target exists, record it. Its coordinates are represented as: 、 ,right and Perform an inverse perspective transformation to obtain the representation of the right rear key point in the vehicle's BEV coordinate system, denoted as . and ; Otherwise, remember , , ; judge Is it true or false? If so, then the default Anchor The key point on the left front of the target exists, let's call it... Its coordinates are represented as: 、 ,right and Perform an inverse perspective transformation to obtain the representation of the left front key point in the vehicle's BEV coordinate system, denoted as . and ; Otherwise, remember , , ; judge Is it true or false? If so, then the default Anchor The key point on the right front of the target exists, record it. Its coordinates are represented as: 、 ,right and Perform an inverse perspective transformation to obtain the representation of the right front key point in the vehicle's BEV coordinate system, denoted as . and ; Otherwise, remember , , ; in, , , , , , , , To be respectively preset Anchor Keypoint in the prediction output pos_bias The output values ​​of the eight output channels of the detection layer are detected; remember Preset Anchor The predicted output corresponds to the target. : and all Add to the first output target set .

9. The 2.5D vehicle detection method according to claim 8, characterized in that, Step 4.3 specifically involves: processing the first output target set. All of them Make the following angle Calculation operations: Let the direction vector of the y-axis in the vehicle's BEV coordinate system be... ; like , , , If only one or more values ​​in the set are 1, then no position estimation is performed; that is, let... ; like , Then the width direction vector According to the right-hand rule, the length direction vector can be obtained. ,but and the direction vector of the y-axis The included angle for: ,in, Represents the width direction vector exist Projection along the axial direction, Represents the width direction vector exist Projection along the axial direction, Represents the length direction vector exist Projection along the axial direction, Represents the length direction vector exist Projection along the axial direction; like , Then the width direction vector According to the right-hand rule, the length direction vector can be obtained. ,but and the direction vector of the y-axis The included angle for: ; like , Then the length direction vector ,but and the direction vector of the y-axis The included angle for: ; like , Then the length direction vector ,but and the direction vector of the y-axis The included angle for: ; in, Represents the cross product of vectors. Represents the dot product of vectors. The function represents taking the sign of the input value; Record the solution angle goal ,Will Add to the second output target set middle.

10. A terminal device, characterized in that, include: Memory, used to store programs; A processor is configured to execute the program stored in the memory, wherein when the program is executed, the processor is configured to perform the 2.5D vehicle detection method as described in any one of claims 1 to 9.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions; when executed by a processor, the computer-executable instructions are used to implement the 2.5D vehicle detection method as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Vehicle orientation detection method and system based on multi-task convolutional neural network

    CN112507862A