A vehicle information detection method and device based on 2D vision

Through the 2D visual detection model and intersection-matching algorithm, the problem of data set construction and model complexity in vehicle orientation and width detection is solved, low-cost and efficient vehicle information acquisition is achieved, and the algorithm requirements of the autonomous driving system are supported.

CN118379705BActive Publication Date: 2024-09-06TANBU TECH (SHANGHAI) CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410809370.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-09-06
Estimated Expiration
2044-06-21

AI Technical Summary

Technical Problem

Existing vehicle orientation and width detection methods have problems such as difficulty in constructing data sets, complex model network structures, high training overhead, and high computing power requirements. They also fail to effectively utilize wheel information, resulting in large errors in calculation results.

Method used

The 2D visual inspection model is used to detect the entire vehicle, head/tail, and wheels. The orientation, distance, and width information of the vehicle are determined through the intersection ratio and multi-wheel matching algorithm. The relationship between the wheel boundary box and the vehicle boundary box is used for accurate subordination. Relational matching, calculating vehicle orientation, distance and width.

Benefits of technology

It achieves simple and effective acquisition of vehicle orientation, distance and width information through 2D vision methods, reduces computing power and storage resource requirements, and supports the speed measurement and ranging and control planning algorithms of the autonomous driving system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118379705B
    Figure CN118379705B
Patent Text Reader

Abstract

The present invention relates to the field of vision-based vehicle recognition technology, and specifically to a vehicle information detection method and device based on 2D vision. The method comprises the following steps: obtaining an image to be detected in front of a main vehicle; inputting the image to be detected into a preset 2D target detection model, identifying a target set of vehicles in the image to be detected, wherein the target set of vehicles includes the coordinates of a target bounding box, the width of the target bounding box, the length of the target bounding box, and the target type, wherein the target type includes: a whole vehicle, a front of the vehicle, a rear of the vehicle, and a wheel; calculating the intersection-and-union ratio, obtaining a corresponding relationship between the front of the vehicle and the whole vehicle, or a corresponding relationship between the rear of the vehicle and the whole vehicle, and a positional relationship between the wheel and the whole vehicle; thereby obtaining the orientation of the whole vehicle, the distance of the whole vehicle relative to the main vehicle, and the width of the whole vehicle. The method of the present invention can simply and effectively obtain the orientation, distance, and width information of the vehicle through a 2D vision method, thereby reducing computing power, storage, and other resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of vehicle recognition based on vision, and in particular to a vehicle information detection method and device based on 2D vision. Background Art

[0002] In the field of autonomous driving, achieving autonomous driving or advanced assisted driving based on vision is a relatively low-cost technical route; and detecting vehicles near the vehicle in the images taken by the camera is one of the basic technologies of this route. The direction and width information of the target vehicle is one of the most important vehicle information that needs to be input into the autonomous driving algorithm.

[0003] There are two existing ways to detect vehicle orientation and width: one is through point cloud detection, which requires expensive lidar sensors; the other is through a convolutional neural network model based on 3D visual target detection. This model has a huge number of parameters and requires long-term and expensive training. It also requires the autonomous driving processor to have powerful computing power, which increases hardware costs.

[0004] There are also some technologies that attempt to identify the vehicle's orientation by simply using a convolutional neural network. For example, in patent CN202110973740.3, the author built a vehicle orientation recognition method and system based on target detection models such as yolov5 and BCNN, but this method requires special annotation of the vehicle's orientation, and an additional network needs to be built to meet this requirement. For example, in patent CN202210068244.8, the author determines the orientation information of the vehicle to be detected through the vehicle's size ratio information, body, and front / rear bounding box information, but this method still has many model parameters and requires high chip computing power. At the same time, it does not make full use of the wheel information that is most helpful for judging the vehicle's orientation.

[0005] Using 2D detection results (the entire vehicle and partial bounding boxes) to infer information such as the vehicle's orientation is currently rarely used and is different from our mechanism. On the other hand, because the bounding boxes of different vehicles may overlap, this will lead to large errors in the calculation results.

[0006] In general, the current implementation methods of vehicle orientation and width detection tasks generally have problems such as difficulty in constructing data sets, complex model network structures, high training costs, and high computing power requirements; or there are technical difficulties that need to be overcome. Summary of the invention

[0007] The present invention proposes a simple and effective method for obtaining vehicle orientation, distance and width information through 2D vision methods. The 2D vision detection model is used to detect the whole body, head / tail, and wheels of multiple vehicles to obtain their bounding box information, and then the relative relationship between the wheel bounding box and the vehicle overall bounding box and the vehicle head / tail bounding box is used. After multiple rounds of matching algorithms, the accurate subordinate relationship between each vehicle and its wheels and head / tail bounding boxes is obtained, and then the vehicle orientation, distance, width and other information are obtained based on the corresponding relationship between the two wheel bounding boxes and the vehicle rear bounding box.

[0008] In order to achieve the above-mentioned object of the invention, the present invention provides the following technical solutions:

[0009] A vehicle information detection method based on 2D vision comprises the following steps:

[0010] Obtain the image to be detected in front of the main vehicle;

[0011] Input the image to be detected into a preset 2D target detection model, and identify a target set of vehicles in the image to be detected, wherein the target set of vehicles includes the coordinates of a target bounding box, the width of the target bounding box, the length of the target bounding box, and the target type, wherein the target type includes: a whole vehicle, a front end, a rear end, and a wheel;

[0012] Calculate the intersection-and-joint ratio between the front of the vehicle and the whole vehicle or the intersection-and-joint ratio between the rear of the vehicle and the whole vehicle in the target set of vehicles, compare the obtained intersection-and-joint ratio with a preset threshold of the intersection-and-joint ratio of the front of the vehicle or the threshold of the intersection-and-joint ratio of the rear of the vehicle, and obtain the corresponding relationship between the front of the vehicle and the whole vehicle or the corresponding relationship between the rear of the vehicle and the whole vehicle according to the comparison result;

[0013] Calculate the intersection-and-union ratio between the wheels and the whole vehicle in the target set of the vehicle, compare the obtained wheel intersection-and-union ratio with a preset wheel intersection-and-union ratio threshold, and obtain the positional relationship between the wheels and the whole vehicle according to the comparison result; the intersection-and-union ratio refers to the ratio of the area of ​​the overlapping area of ​​two target bounding boxes in the same plane to the area of ​​the union of the two target bounding boxes;

[0014] The orientation of the vehicle is obtained through the corresponding relationship between the front of the vehicle and the vehicle or the corresponding relationship between the rear of the vehicle and the vehicle;

[0015] The positional relationship between the center points of the bounding boxes of the two wheels of the same vehicle and the positional relationship between the vertices of the bounding box of the rear of the vehicle are transformed from the image coordinate system to the physical world coordinate system to obtain the distance of the vehicle relative to the main vehicle in the image to be detected and the width of the vehicle.

[0016] As a preferred solution, when the intersection-and-union ratio is compared with a preset front-end intersection-and-union ratio threshold or a rear-end intersection-and-union ratio threshold, if the front-end bounding box or the rear-end bounding box has an intersection-and-union ratio greater than the threshold with only one of the bounding boxes of the entire vehicle, but the intersection-and-union ratios with the bounding boxes of other entire vehicle targets are all less than the threshold, then it is determined that the front or rear of the vehicle belongs to the entire vehicle.

[0017] As a preferred solution, the method further includes determining the positional relationship between the whole vehicle and the main vehicle, including the following steps:

[0018] If the center of the frame of the front or rear of the vehicle is on the right side of the center of the frame of the entire vehicle, then the entire vehicle is on the right side of the main vehicle; if the center of the frame of the front or rear of the vehicle is on the left side of the center of the frame of the entire vehicle, then the entire vehicle is on the left side of the main vehicle.

[0019] As a preferred solution, determining the positional relationship between the whole vehicle and the main vehicle further includes determining whether the whole vehicle and the main vehicle are in the same direction, including the following steps:

[0020] If it is determined that the front of the vehicle belongs to a whole vehicle, then the whole vehicle and the main vehicle are traveling in opposite directions; if it is determined that the rear target belongs to a whole vehicle, then the whole vehicle and the main vehicle are traveling in the same direction.

[0021] As a preferred solution, the obtained wheel intersection-and-parallel ratio is compared with a preset wheel intersection-and-parallel ratio threshold, and the positional relationship between the wheel and the whole vehicle is obtained according to the comparison result, including the following steps:

[0022] Calculate the intersection-and-union ratio of the wheel bounding box and the vehicle bounding box, and compare the obtained wheel intersection-and-union ratio with a preset wheel intersection-and-union ratio threshold. If the wheel intersection-and-union ratio is greater than the preset wheel intersection-and-union ratio threshold, the wheel belongs to the vehicle.

[0023] If the vehicle is on the left side of the main vehicle,

[0024] If the distance between the right side of the wheel boundary box and the right side of the vehicle boundary box is smaller than the distance between the left side of the wheel boundary box and the right side of the front / rear boundary box of the vehicle, then when the vehicle and the host vehicle are traveling in the same direction, the wheel is the front wheel of the vehicle; when the vehicle and the host vehicle are traveling in opposite directions, the wheel is the rear wheel of the vehicle;

[0025] If the whole vehicle is on the right side of the main vehicle, if the wheel is closer to the right side of the vehicle, that is, the distance between the right side of the wheel boundary box and the right side of the front / rear boundary box of the whole vehicle is smaller than the distance between the left side of the wheel boundary box and the left side of the whole vehicle boundary box, then when the whole vehicle and the main vehicle are traveling in the same direction, the wheel is the rear wheel of the whole vehicle; when the vehicle and the main vehicle are traveling in opposite directions, the wheel is the front wheel of the whole vehicle.

[0026] As a preferred solution, a second round of matching judgment is also included, including the following steps:

[0027] Traverse all target bounding boxes of type "whole vehicle" in the target set of vehicles,

[0028] If the number of front wheels of the vehicle is greater than 1, the intersection-and-union ratio of the bounding box of each front wheel and the bounding box of the vehicle is calculated, and the front wheel with the largest intersection-and-union ratio is determined as the front wheel of the vehicle;

[0029] If the number of rear wheels of the whole vehicle is greater than 1, the intersection-and-union ratio of the bounding box of each rear wheel and the bounding box of the whole vehicle is calculated, and the rear wheel with the largest intersection-and-union ratio is determined as the rear wheel of the whole vehicle.

[0030] As a preferred solution, for wheels that have not been determined to belong to the entire vehicle, a third wheel matching judgment is also included, including the following steps:

[0031] Traverse the wheel bounding box and calculate the intersection-and-union ratio of the wheel bounding box and the vehicle bounding box. If the intersection-and-union ratio is greater than the preset wheel intersection-and-union ratio threshold, the wheel belongs to the current vehicle and the front wheel of the current vehicle is determined. If the current vehicle already has a front wheel, continue traversing until the wheel is matched to the vehicle.

[0032] As a preferred solution, the value range of the front vehicle intersection-to-merge ratio threshold or the rear vehicle intersection-to-merge ratio threshold is 0.6-0.9.

[0033] As a preferred solution, the wheel intersection ratio threshold value ranges from 0.5 to 0.8.

[0034] Based on the same concept, a vehicle information detection device based on 2D vision is also proposed, including an image acquisition device, an analysis module and a data output module.

[0035] The image acquisition device is used to obtain the image to be detected in front of the main vehicle;

[0036] The analysis module is used to obtain the orientation of the entire vehicle in the image to be detected, the distance of the entire vehicle relative to the main vehicle, and the width of the entire vehicle by using any of the above-mentioned vehicle information detection methods based on 2D vision.

[0037] Compared with the prior art, the beneficial effect of the present invention is that the method of the present invention can simply and effectively obtain the vehicle's direction, distance and width information through a 2D visual method, thereby supporting the automatic driving system to implement speed and distance measurement algorithms and control planning algorithms, and reducing resource requirements such as computing power and storage. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 is a flow chart of a vehicle information detection method based on 2D vision in Example 1;

[0039] Figure 2 is a schematic diagram of the detection results of each vehicle boundary box in Example 1;

[0040] Figure 3 Schematic diagram of calculating the intersection-over-union (IOU) ratio and area ratio in Example 1;

[0041] Figure 4 This is the vehicle head / vehicle tail matching flow chart in Example 1;

[0042] Figure 5 is the first wheel matching flow chart in Example 1;

[0043] Figure 6 is the second wheel matching flow chart in Example 1;

[0044] Figure 7 is the third wheel matching flow chart in Embodiment 1;

[0045] Figure 8 This is a schematic diagram of a detection result of an actual scene in Example 1. DETAILED DESCRIPTION

[0046] The present invention is further described in detail below in conjunction with the examples and specific implementation methods. However, this should not be understood as the scope of the above subject matter of the present invention being limited to the following examples, and all technologies realized based on the content of the present invention belong to the scope of the present invention.

[0047] Example 1

[0048] A vehicle information detection method based on 2D vision, the flow chart is as follows Figure 1 As shown, the following steps are included:

[0049] Obtain the image to be detected in front of the main vehicle;

[0050] Input the image to be detected into a preset 2D target detection model, and identify a target set of vehicles in the image to be detected, wherein the target set of vehicles includes the coordinates of a target bounding box, the width of the target bounding box, the length of the target bounding box, and the target type, wherein the target type includes: a whole vehicle, a front end, a rear end, and a wheel;

[0051] Calculate the intersection-and-joint ratio between the front of the vehicle and the whole vehicle or the intersection-and-joint ratio between the rear of the vehicle and the whole vehicle in the target set of vehicles, compare the obtained intersection-and-joint ratio with a preset threshold of the intersection-and-joint ratio of the front of the vehicle or the threshold of the intersection-and-joint ratio of the rear of the vehicle, and obtain the corresponding relationship between the front of the vehicle and the whole vehicle or the corresponding relationship between the rear of the vehicle and the whole vehicle according to the comparison result;

[0052] Calculate the intersection-and-union ratio between the wheels and the whole vehicle in the target set of the vehicle, compare the obtained wheel intersection-and-union ratio with a preset wheel intersection-and-union ratio threshold, and obtain the positional relationship between the wheel and the whole vehicle based on the comparison result; the intersection-and-union ratio refers to the ratio of the area of ​​the overlapping area of ​​two target bounding boxes in the same plane to the sum of the areas of the non-overlapping areas;

[0053] The orientation of the vehicle is obtained through the corresponding relationship between the front of the vehicle and the vehicle or the corresponding relationship between the rear of the vehicle and the vehicle;

[0054] The positional relationship between the center points of the bounding boxes of the two wheels of the same vehicle and the positional relationship between the vertices of the bounding box of the rear of the vehicle are transformed from the image coordinate system to the physical world coordinate system to obtain the distance of the vehicle relative to the main vehicle in the image to be detected and the width of the vehicle.

[0055] The process and principle of the present invention will be described in detail below:

[0056] 1. Setting

[0057] This solution is based on the following assumptions or definitions:

[0058] 1) The camera is a front-view camera, installed in the middle of the front of the main vehicle;

[0059] 2) The resolution of the image captured by the camera is fixed, represented by Res_X and Res_Y. For example, 1280*720 means that the horizontal resolution of the image is 1280 pixels and the vertical resolution is 720 pixels, that is, Res_X=1280, Res_Y=720;

[0060] 3) Wheels can only be detected if their complete outline is visible, which means that at most two wheels can be detected per vehicle;

[0061] 4) Intersection-over-Union (IOU) Definition: The IOU is the ratio of the area of ​​the overlapping region of two polygons in the same plane to the sum of the areas of the non-overlapping regions. For a rectangle, the IOU can be calculated by simple plane geometry, such as Figure 3 As shown in the figure, the intersection-over-union (IOU) value of A and B is: IOU = (C) / (A+BC), and the area ratio of A and B is: Rate = C / A.

[0062] 5) Set the “front-end-end intersection ratio judgment threshold”: IOU_Th head_tail =0.8 (the specific value can be adjusted according to the application scenario, generally between 0.6-0.9); In addition, set a "wheel intersection ratio judgment threshold" IOU_Th wheel =0.7 (It can be adjusted according to the application scenario, generally between 0.5-0.8). The definition of intersection-union ratio is shown in 3.2.

[0063] 6) For the same vehicle, its front and rear cannot be detected at the same time. The schematic diagram of the front / rear part and front / rear wheels of the vehicle is as follows: Figure 2 .

[0064] 7) Main vehicle: refers to the vehicle where the camera is located, and also the vehicle where the device running this solution is located.

[0065] 2. Original Data Acquisition

[0066] After the camera takes a picture of the front of the vehicle, it first uses a 2D target detection model that has been fully trained to detect the entire vehicle, the front of the vehicle, the rear of the vehicle, the wheels, and other targets to detect the image and obtain a set of multiple discrete original targets in front of the vehicle (called the "target set", T). The number of elements in this set is NumerOfAllTargets. For the sake of convenience, we denote the i-th element of the set T by T[i]. Each element in the set contains the following original attribute fields:

[0067] BBox.X, which indicates the X coordinate of the upper left corner of the target rectangular bounding box (the number of horizontal pixels relative to the upper left corner of the image);

[0068] BBox.Y, which indicates the Y coordinate of the upper left corner of the target rectangular bounding box (the number of vertical pixels relative to the upper left corner of the image);

[0069] BBox.W, which indicates the width of the target rectangular bounding box (in pixels);

[0070] BBox.H, represents the height of the target rectangular bounding box (number of pixels);

[0071] Class, which indicates the target category, can be the entire vehicle (VEHICLE, 0), the front of the vehicle (HEAD, 1), the rear of the vehicle (TAIL, 2), or the wheel (WHEEL, 3);

[0072] Each attribute field of each element in the target set comes from the output of model detection and therefore has a definite value.

[0073] 3. Target Matching

[0074] The purpose of target matching is to determine the following information as much as possible: the vehicle target to which the front and rear targets belong; the position (left or right) and direction (opposite or same) of the vehicle target relative to the main vehicle; the vehicle to which the wheel target belongs and its front and rear position (front wheel or rear wheel), etc. The specific steps are as follows: first perform the front / rear matching, then perform the wheel matching. During the wheel matching, first perform the first round of wheel matching, then the second round of wheel matching, and finally the third round of wheel matching. After the third round of wheel matching, the target matching is completed. The flow chart of the front / rear matching is as follows: Figure 4 As shown, the first round of wheel matching flow chart is as follows Figure 5 As shown, the second round of wheel matching flow chart is as follows Figure 6 As shown, the third wheel matching flow chart is as follows Figure 7 shown.

[0075] 3.1 Data Extension

[0076] 1) First, for the elements of the target set T whose category is "complete vehicle", the following attributes are expanded (the original attributes remain unchanged):

[0077] Side: indicates whether the vehicle is on the right side (RIGHT, 0) or the left side (LEFT, 1) of the main vehicle. Its initial value is unknown (UNKNOWN, -1).

[0078] Direction: indicates the direction relationship between the vehicle and the main vehicle. It can be the same direction (SAME, 0) or opposite direction (OPPOSITE, 1). Its initial value is unknown (UNKNOWN, -1);

[0079] HeadTail: The index of the front or rear of the vehicle in the target set. Its initial value is unknown (UNKNOWN, -1);

[0080] FrontWheel: The index of the determined front wheel of the vehicle in the target set. Its initial value is unknown (UNKNOWN, -1);

[0081] PossibleFrontWheels[2]: the index of multiple wheel targets that may be the front wheels of the vehicle in the target set. Their initial values ​​are all unknown (UNKNOWN, -1);

[0082] In common cases, due to the overlap of bounding boxes, no more than two wheels are classified as being in the same position of the same vehicle during the initial judgment, and the same applies below.

[0083] RearWheel: The index of the determined rear wheel of the vehicle in the target set. Its initial value is unknown (UNKNOWN, -1);

[0084] PossibleRearWheels[2]: The indices of multiple wheel targets that may be the rear wheels of the vehicle in the target set. Their initial values ​​are all unknown (UNKNOWN, -1).

[0085] 2) For the elements of the target set T whose category is "wheel", the following attributes are extended (the original attributes remain unchanged):

[0086] PossibleVehicles[2]: the index of the vehicle target to which the wheel may belong in the target set. Its initial value is unknown (UNKNOWN, -1);

[0087] Association_state[2]: whether the wheel has been determined to be the front / rear wheel of a vehicle (0: uncertain; 1: confirmed; initial value is 0);

[0088] In common cases, due to the overlap of bounding boxes, no more than two wheels are classified as being in the same position of the same vehicle during the initial judgment, and the same applies below.

[0089] For the convenience of description, the expanded target set is still referred to as the "target set" below, and an element in the set is referred to as a "target".

[0090] 3.2 Determine the vehicle to which the front / rear end belongs

[0091] For each target classified as "front" or "rear" in the target set, calculate the intersection-over-union ratio of its bounding box with the bounding boxes of all targets of type "whole vehicle", and compare it with the "front-rear intersection-over-union ratio judgment threshold" (IOU_Th head_tail ) for comparison, and then perform the following steps:

[0092] If the bounding box intersection and union ratio of the front or rear target with only one of the whole vehicle targets is greater than the threshold, and the bounding box intersection and union ratios of the front or rear target with other whole vehicle targets are all less than the threshold, then it can be determined that the front / rear target belongs to the whole vehicle target.

[0093] If the intersection / merge ratios of a certain front / rear target with multiple whole vehicle targets are all greater than a threshold, the improved Hungarian algorithm (also known as the KM algorithm) can be used to further determine the whole vehicle target to which the front / rear target belongs (this algorithm is not within the scope of this patent). This situation is not common.

[0094] After accurately determining the vehicle target (assuming T[j]) to which a certain front / rear target (assuming T[i]) belongs, perform the following steps:

[0095] 1) Set the vehicle to which the head / tail belongs: T[j].HeadTail = i.

[0096] 2) Determine the positional relationship between the vehicle target and the main vehicle (whether it is on the left or right side of the main vehicle): The positional relationship between the vehicle target and the main vehicle is consistent with the positional relationship between the center of the front / rear bounding box of the vehicle and the center of the vehicle bounding box. Specifically:

[0097] If (T[i].BBox.X+T[i].BBox.W / 2)>(T[j].BBox.X+ T[j].BBox.W / 2) holds, that is, the center of the bounding box of the front and rear of the vehicle is to the right of the center of the bounding box of the entire vehicle, then:

[0098] T[j].Side = RIGHT, otherwise T[j].Side = LEFT;

[0099] Among them, T[i].BBox.X represents the X coordinate of the upper left corner vertex of the target rectangular bounding box of the i-th front / rear target, T[i].BBox.W represents the width of the target rectangular bounding box of the i-th front / rear target, T[j].BBox.X represents the X coordinate of the upper left corner vertex of the target rectangular bounding box of the j-th whole vehicle target, and T[j].BBox.W represents the width of the target rectangular bounding box of the j-th whole vehicle target.

[0100] 3) Further, it can be determined whether the whole vehicle target and the main vehicle are in the same direction. If it is determined that the target at the front of the vehicle belongs to the whole vehicle, then the whole vehicle and the main vehicle are traveling in opposite directions; if it is determined that the target at the rear of the vehicle belongs to the whole vehicle, then the whole vehicle and the main vehicle are traveling in the same direction. That is:

[0101] If (T[i].Class == TAIL) is true, then

[0102] T[j].Direction = SAME;

[0103] If (T[i].Class == HEAD) is true, then

[0104] T[j].Direction = OPPOSITE;

[0105] T[i].Class represents the target class of the i-th vehicle front / rear target, TAIL represents the rear of the vehicle, HEAD represents the front of the vehicle, and T[j].Direction represents the direction relationship between the j-th vehicle and the main vehicle, SAME represents the same direction, and OPPOSITE represents the opposite direction.

[0106] 2.3 Wheel Matching

[0107] In actual scenarios, the 2D bounding boxes of vehicles often overlap, so two rounds of calculation and comparison are required to complete the matching. Specifically:

[0108] First round of matching

[0109] Traverse all targets of type "wheel" and type "whole vehicle" in the target set and perform the following operations:

[0110] 1) Calculate the IOU of the bounding box of the wheel target (assuming T[i]) and the bounding box of the vehicle target (assuming T[j]) ij and the “wheel intersection-union ratio judgment threshold” (IOU_Th wheel )Compare;

[0111] 2) If the intersection-and-union ratio is greater than the threshold, wheel i may belong to vehicle j. At this time, we should continue to determine the possible position of wheel i in the vehicle. The steps are as follows:

[0112] A) If vehicle j is on the left side of the main vehicle, that is, (T[j].Side==LEFT) is true, then:

[0113] ① If the wheel is closer to the right side of the vehicle, that is, the distance between the right side of the wheel bounding box and the right side of the vehicle bounding box is smaller than the distance between the left side of the wheel bounding box and the right side of the front / rear bounding box of the vehicle, that is

[0114] (T[j].BBox.X+T[j].BBox.W)-(T[i].BBox.X+T[i].BBox.W) is less than T[i].BBox.X-(T[T[j].HeadTail].BBox.X+T[T[j].HeadTail].BBox.W), then when the vehicle is traveling in the same direction as the main vehicle, the wheel is the front wheel of the vehicle; when the vehicle is traveling in the opposite direction to the main vehicle, the wheel is the rear wheel of the vehicle;

[0115] Among them, T[j].Side indicates that the jth vehicle is on the left or right side of the main vehicle. When the value is LEFT, the jth vehicle is on the left side of the main vehicle; T[j].BBox.X indicates the X coordinate of the upper left corner vertex of the target rectangular bounding box of the jth vehicle target, T[j].BBox.W indicates the width of the target rectangular bounding box of the jth vehicle target, T[i].BBox.X indicates the X coordinate of the upper left corner vertex of the target rectangular bounding box of the i-th head / tail target, T[i].BBox.W indicates the width of the target rectangular bounding box of the i-th head / tail target, T[T[j].HeadTail].BBox.X indicates the X coordinate of the upper left corner vertex of the rectangular bounding box of the head or tail of the jth vehicle corresponding to the index of the head or tail, and T[T[j].HeadTail].BBox.W indicates the width of the rectangular bounding box of the head or tail corresponding to the index of the head or tail of the jth vehicle.

[0116] ② On the contrary, if the wheel is closer to the left side of the vehicle, then when the vehicle is traveling in the same direction as the main vehicle, the wheel is the rear wheel of the vehicle; when the vehicle is traveling in the opposite direction to the main vehicle, the wheel is the front wheel of the vehicle.

[0117] B) If vehicle j is on the right side of the host vehicle, that is, (T[j].Side==RIGHT) is true, then:

[0118] ① If the wheel is closer to the right side of the vehicle, that is, the distance between the right side of the wheel bounding box and the right side of the front / rear bounding box of the vehicle is smaller than the distance between the left side of the wheel bounding box and the left side of the vehicle bounding box, that is

[0119] If T[T[j].HeadTail].BBox.X-(T[i].BBox.X+T[i].BBox.W) is less than (T[i].BBox.XT[j].BBox.X), then when the vehicle is traveling in the same direction as the main vehicle, the wheel is the rear wheel of the vehicle; when the vehicle is traveling in the opposite direction to the main vehicle, the wheel is the front wheel of the vehicle.

[0120] ② On the contrary, if the wheel is closer to the left side of the vehicle, then when the vehicle is traveling in the same direction as the main vehicle, the wheel is the front wheel of the vehicle; when the vehicle is traveling in the opposite direction to the main vehicle, the wheel is the rear wheel of the vehicle.

[0121] C) Based on the above judgment, find a component equal to UNKNOWN in T[j].PossibleFrontWheels[0-1] (if it is judged to be the front wheel) or T[j].PossibleRearWheels[0-1] (if it is judged to be the rear wheel), and assign it to i. T[j].PossibleFrontWheels[0-1] represents the index of multiple wheel targets of the j-th vehicle in the target set.

[0122] After the first round of matching, several alternative front and rear wheels will be found for all vehicle targets.

[0123] Second round of matching

[0124] Traverse all targets of type "whole vehicle" in the target set and perform the following operations:

[0125] 1) If more than one of the values ​​of the vehicle target (assuming that the number of candidate front wheels in T[j] is greater than 1, that is, T[j].PossibleFrontWheels[0-1]) is not UNKNOWN, then calculate the intersection and union ratio of the bounding boxes of each candidate front wheel and the vehicle in turn, and set the largest one (assuming that it is T[j].PossibleFrontWheels[assure]) as the confirmed front wheel of the vehicle, that is, T[i].FrontWheel = T[j].PossibleFrontWheels[assure], where assure is the index of the confirmed wheel and the value range of assure is 0 or 1, 1 represents the front wheel and 0 represents not the front wheel.

[0126] 2) If more than one of the vehicle targets (assuming that the number of candidate rear wheels in T[i] is greater than 1, i.e., T[j].PossibleRearWheels[0-1]) has a value other than UNKNOWN, then calculate the intersection and union ratio of the bounding boxes of each candidate rear wheel and the vehicle in turn, and set the largest one (assuming that it is T[j].PossibleRearWheels[assure]) as the confirmed front wheel of the vehicle, i.e., T[j].RearWheel = T[j].PossibleRearWheels[assure];

[0127] T[j].RearWheel represents the index of the determined rear wheel of the j-th vehicle in the target set, and T[j].PossibleRearWheels[0-1] represents the index of multiple wheel targets of the rear wheel of the j-th vehicle in the target set;

[0128] After the second round of matching, all vehicles will have confirmed front and rear wheels "as far as possible", and the confirmed wheel's association_state will be assigned a value of 1. association_state indicates whether the wheel has been determined as the front / rear wheel of a certain vehicle. A value of 1 indicates that the wheel has been determined as the front / rear wheel of a certain vehicle.

[0129] Third round of matching

[0130] Traverse all objects of type "wheel" and association_state 0 in the target collection, assuming it is T[i], and process them according to the following logic:

[0131] For wheel T[i=m], calculate the intersection-over-union (IOU) of the object T[j] of type "vehicle" in the target set. ij , assuming that this wheel will be matched to the front wheel position of T[j=k], if

[0132] 1) T[j=k].FrontWheel has matched the wheel T[i, i≠m], so the traversal will continue; T[j=k].FrontWheel represents the index of the front wheel of the kth vehicle in the target set;

[0133] 2) If T[j=k].FrontWheel does not match a vehicle, then T[i=m] is assigned to this variable, that is, wheel T[i=m] is matched to the front wheel of vehicle T[j=k];

[0134] Generally, situation 1) often occurs when the bounding boxes of two vehicles overlap, that is, this wheel is either the rear wheel of the front vehicle or the front wheel of the rear vehicle. If, during the traversal, the current vehicle (rear vehicle) already has a front wheel (which means that in the previous matching, the intersection-and-union ratio of that wheel and the vehicle is higher than the intersection-and-union ratio of this wheel and the vehicle), then continue to traverse, and when traversing to the front vehicle, it can be successfully matched to the rear wheel of the front vehicle, that is, wheel T[i=m] will be matched to the rear wheel of vehicle T[j=h], and the vehicle referred to by i=m is adjacent to the vehicle referred to by j=h, and the vehicle referred to by i=m is the vehicle at the rear, and the vehicle referred to by j=h is the vehicle at the front. In general, the 2D bounding box of a wheel overlaps with the 2D bounding boxes of at most two vehicles in the image, so the wheel matching task can be completed in the third round of matching.

[0135] In the actual test and experiment process, we verified the effectiveness of this algorithm. Figure 8 As shown, in this actual example, there are two vehicles A and B. The detection results in the image coordinate system have obvious overlap, and the rear of the vehicle 1 and the rear of the vehicle 2, wheels a, wheel b, wheel c and wheel d are detected. When matching, if only relying on calculating the intersection-over-union ratio (IOU) for matching, it may cause wheel c that originally belongs to vehicle B to be assigned to vehicle A. However, through our matching algorithm, if wheel c belongs to vehicle A, then it can only be the rear wheel of vehicle A. However, in the first and second rounds of wheel matching, wheel b has occupied the position of the rear wheel of the vehicle, and the intersection-over-union ratio value is greater than wheel c. At this time, wheel c can be matched to vehicle B in the third round of matching. This verifies the effectiveness of the matching algorithm of the present invention.

[0136] 4. Processing and Analyzing Results

[0137] After the above matching process, each vehicle target has been determined as far as possible with its associated front or rear, its position (left or right) and direction (same direction or opposite direction) relative to the main vehicle, and the information of the front and rear wheels it contains. In addition, combined with the BEV bird's eye view, perspective transformation and other general algorithms, the width of the vehicle (based on the width of the front or rear), the direction of the vehicle (for example, based on the line connecting the bottom midpoints of the front and rear wheel bounding boxes) and other information are obtained. This information is very important input information for the vision-based advanced driver assistance system (ADAS).

[0138] After obtaining the bounding box of the whole vehicle, the bounding box of the front or rear of the vehicle, in the BEV bird's eye view, the bounding box of the front or rear of the vehicle is a 2D rectangular box. The distance from the rear end of the rectangle to the main vehicle can be considered as the distance between the rear of the vehicle and the main vehicle, the length can be considered as the length of the vehicle, and the width can be considered as the width of the vehicle. Converting the bounding box of the whole vehicle, the bounding box of the front or rear of the vehicle to the BEV perspective is actually an inverse perspective transformation based on the camera imaging principle. The line connecting the midpoints of the bottom of the two wheels and the two intersection points of the bounding box of the whole vehicle and the bounding box of the rear of the vehicle are used as reference points to construct three-dimensional coordinates. The direction of the bounding box of the front or rear of the vehicle is the x-axis direction and the z-axis direction, and the direction of the line connecting the midpoints of the bottom of the two wheels is the y-axis direction. Convert the 2D rectangular box to the three-dimensional space under the BEV perspective, and perform an inverse perspective transformation on the 2D rectangular box to obtain the three-dimensional physical coordinates of the reference point under the BEV perspective of the target vehicle, so that the distance between the whole vehicle and the main vehicle can be calculated based on the three-dimensional physical coordinates of the camera. The width of the vehicle can be calculated based on the width of the bounding box of the front or rear of the vehicle.

[0139] This provides greater possibilities for achieving advanced assisted driving without relying on 3D object detection, which requires high computing power, but only requires 2D object detection technology, which requires lower computing power.

[0140] Finally, it should be noted that the embodiments described in detail above are only the best practices of the invention and cannot be used to limit the scope of rights of the invention. Equivalent replacement of the technical solutions recorded in the aforementioned embodiments does not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the invention, and they should all be included in the scope of the claims and description of the invention.

Claims

1. A vehicle information detection method based on 2D vision, characterized in that: The following steps are involved: Obtain the image to be detected in front of the main vehicle; Input the image to be detected into a preset 2D target detection model, and identify a target set of vehicles in the image to be detected, wherein the target set of vehicles includes the coordinates of a target bounding box, the width of the target bounding box, the length of the target bounding box, and the target type, wherein the target type includes: a whole vehicle, a front end, a rear end, and a wheel; Calculate the intersection-and-joint ratio between the front of the vehicle and the whole vehicle or the intersection-and-joint ratio between the rear of the vehicle and the whole vehicle in the target set of vehicles, compare the obtained intersection-and-joint ratio with a preset threshold of the intersection-and-joint ratio of the front of the vehicle or the threshold of the intersection-and-joint ratio of the rear of the vehicle, and obtain the corresponding relationship between the front of the vehicle and the whole vehicle or the corresponding relationship between the rear of the vehicle and the whole vehicle according to the comparison result; Calculate the intersection-and-union ratio between the wheels and the whole vehicle in the target set of the vehicle, compare the obtained wheel intersection-and-union ratio with a preset wheel intersection-and-union ratio threshold, and obtain the positional relationship between the wheels and the whole vehicle according to the comparison result; the intersection-and-union ratio refers to the ratio of the area of ​​the overlapping area of ​​two target bounding boxes in the same plane to the area of ​​the union of the two target bounding boxes; The orientation of the vehicle is obtained through the corresponding relationship between the front of the vehicle and the vehicle or the corresponding relationship between the rear of the vehicle and the vehicle; The positional relationship between the center points of the bounding boxes of the two wheels of the same vehicle and the positional relationship between the vertices of the bounding box of the rear of the vehicle are transformed from the image coordinate system to the physical world coordinate system to obtain the distance of the vehicle relative to the main vehicle in the image to be detected and the width of the vehicle; The obtained wheel intersection-and-parallel ratio is compared with a preset wheel intersection-and-parallel ratio threshold, and the positional relationship between the wheel and the whole vehicle is obtained according to the comparison result, including the following steps: Calculate the intersection-and-union ratio of the wheel bounding box and the vehicle bounding box, and compare the obtained wheel intersection-and-union ratio with a preset wheel intersection-and-union ratio threshold. If the wheel intersection-and-union ratio is greater than the preset wheel intersection-and-union ratio threshold, the wheel belongs to the vehicle. If the vehicle is on the left side of the main vehicle, If the distance between the right side of the wheel boundary box and the right side of the vehicle boundary box is smaller than the distance between the left side of the wheel boundary box and the right side of the front / rear boundary box of the vehicle, then when the vehicle and the host vehicle are traveling in the same direction, the wheel is the front wheel of the vehicle; when the vehicle and the host vehicle are traveling in opposite directions, the wheel is the rear wheel of the vehicle; If the vehicle is on the right side of the host vehicle, and if the wheel is closer to the right side of the vehicle, that is, the distance between the right side of the wheel boundary box and the right side of the front / rear boundary box of the vehicle is smaller than the distance between the left side of the wheel boundary box and the left side of the vehicle boundary box, then if the vehicle and the host vehicle are traveling in the same direction, the wheel is the rear wheel of the vehicle; if the vehicle and the host vehicle are traveling in opposite directions, the wheel is the front wheel of the vehicle; A second round of matching judgment is also included, including the following steps: Traverse all target bounding boxes of type "whole vehicle" in the target set of vehicles, If the number of front wheels of the vehicle is greater than 1, the intersection-and-union ratio of the bounding box of each front wheel and the bounding box of the vehicle is calculated, and the front wheel with the largest intersection-and-union ratio is determined as the front wheel of the vehicle; If the number of rear wheels of the vehicle is greater than 1, the intersection-and-union ratio of the bounding box of each rear wheel and the bounding box of the vehicle is calculated, and the rear wheel with the largest intersection-and-union ratio is determined as the rear wheel of the vehicle; For wheels that have not been determined to belong to the entire vehicle, a third wheel matching judgment is also included, including the following steps: Traverse the wheel bounding box and calculate the intersection and union ratio of the wheel bounding box and the vehicle bounding box. If the intersection and union ratio is greater than the preset wheel intersection and union ratio threshold, the wheel belongs to the current vehicle and the front wheel of the current vehicle is determined; if the current vehicle already has a front wheel, continue traversing until the wheel is matched to the vehicle.

2. A vehicle information detection method based on 2D vision as claimed in claim 1, characterized in that: When comparing the intersection-and-union ratio with the preset front-end intersection-and-union ratio threshold or the rear-end intersection-and-union ratio threshold, if the front-end bounding box or the rear-end bounding box has an intersection-and-union ratio greater than the threshold with only one of the bounding boxes of the entire vehicle, but has an intersection-and-union ratio with the bounding boxes of other entire vehicle targets less than the threshold, then it is determined that the front-end or the rear-end belongs to the entire vehicle.

3. The vehicle information detection method based on 2D vision as claimed in claim 1, characterized in that: It also includes determining the positional relationship between the whole vehicle and the main vehicle, including the following steps: If the center of the frame of the front or rear of the vehicle is on the right side of the center of the frame of the entire vehicle, then the entire vehicle is on the right side of the main vehicle; if the center of the frame of the front or rear of the vehicle is on the left side of the center of the frame of the entire vehicle, then the entire vehicle is on the left side of the main vehicle.

4. A vehicle information detection method based on 2D vision as claimed in claim 3, characterized in that: Determining the positional relationship between the whole vehicle and the main vehicle also includes determining whether the whole vehicle and the main vehicle are in the same direction, including the following steps: If it is determined that the front of the vehicle belongs to a whole vehicle, then the whole vehicle and the main vehicle are traveling in opposite directions; if it is determined that the rear target belongs to a whole vehicle, then the whole vehicle and the main vehicle are traveling in the same direction.

5. The vehicle information detection method based on 2D vision as claimed in claim 1, characterized in that: The value range of the front vehicle intersection-merge ratio threshold or the rear vehicle intersection-merge ratio threshold is 0.6-0.

9.

6. The vehicle information detection method based on 2D vision as claimed in claim 1, characterized in that: The wheel intersection ratio threshold value ranges from 0.5 to 0.

8.

7. A vehicle information detection device based on 2D vision, characterized in that: It includes image acquisition equipment, analysis module and data output module. The image acquisition device is used to obtain the image to be detected in front of the main vehicle; The analysis module is used to obtain the orientation of the entire vehicle in the image to be detected, the distance of the entire vehicle relative to the main vehicle, and the width of the entire vehicle by adopting a 2D vision-based vehicle information detection method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Vehicle orientation recognition method and system based on yov5 and BCNN

    CN113850136A

  • Vehicle orientation identification and acquisition method

    CN114511838A

  • Driving direction detection method and device, computer equipment and storage medium

    CN112861683A

  • Method and device for calculating course angle of target vehicle based on visual information

    CN114549645A

  • Obstacle vehicle pose estimation method and device

    CN115861975A