Distance detection method, vehicle high beam control method, device, medium and vehicle

The model is obtained through the on-board camera and offset, and the feature map of the headlight pair in the vehicle image is extracted, and combined with the Hungarian matching algorithm and camera internal reference, the problem of vehicle distance detection in night scenes is solved, achieving accurate workshop distance detection.

CN115082894BActive Publication Date: 2025-05-02安徽蔚来智驾科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210653543.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-09
Publication Date
2025-05-02
Estimated Expiration
2042-06-09

AI Technical Summary

Technical Problem

In night scenes, how to realize vehicle distance detection based on the headlight pair through visual image processing only, especially when the front headlights are turned on, the overall target of the vehicle cannot be seen, and only the light source of the headlight pair can be seen.

Method used

The vehicle image is obtained through the on-board camera, and the trained offset acquisition model is used to extract the feature map of the headlight pair, including the headlight points and predict the offset of the paired headlight points. The target headlight pair is obtained through the Hungarian matching algorithm, and the distance between the target headlight pair and the camera inside the camera is calculated based on the preset headlight pair distance and camera internal reference.

Benefits of technology

It realizes that the workshop distance between the vehicle and the vehicle in front is accurately detected through visual image processing in night scenes, improves the accuracy of the detection of the headlight pair, and simplifies the calculation of the workshop distance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115082894B_ABST
    Figure CN115082894B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of assisted driving, and specifically provides a distance detection method, a vehicle high beam control method, a device, a medium and a vehicle, aiming to solve the problem of how to realize vehicle distance detection based on light pairs only through visual image processing in night scenes. To this end, the method of the present invention includes: obtaining a light point feature map including light points, offsets of predicted paired light points and classification features of light points, obtaining a target light pair through a Hungarian matching algorithm, and then obtaining the vehicle-to-vehicle distance based on the pixel-level distance of the target light pair, a preset light pair distance and a camera focal length. In the technical solution of the present invention, the accuracy of light pair detection can be improved by utilizing the learning ability of a neural network; and the calculation of the vehicle-to-vehicle distance is greatly simplified by introducing a preset light pair distance. The present invention provides a simple and reliable solution for vehicle-to-vehicle distance detection only through visual image processing at night, and has high practicality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of assisted driving, and specifically provides a distance detection method, electronic equipment, storage medium and vehicle. Background Art

[0002] With the rapid development of new technologies such as computing technology and sensor technology, assisted driving functions have been valued and applied by many automobile manufacturers, making the driving process easier and safer. For example, the automatic high beam control in assisted driving can automatically control the high beam on or off according to the distance between the vehicle in front and the vehicle in front when the vehicle is driving at night, or remind the driver of the vehicle to pay attention to control the high beam, so as to avoid the high beam from interfering with the driver of the vehicle in front and affecting the driving safety of the vehicle in front and the vehicle itself.

[0003] In the automatic high beam control of assisted driving, the distance between the vehicle and the vehicle in front is usually used as the control basis. In the monocular 3D vision solution, the 3D properties of obstacles in the image, such as position, orientation, length, width and height, can be obtained through the joint annotation of LiDAR and vision; then the distance of the target is obtained through the deep learning network. However, in night scenes, when the front lights are turned on, the overall target of the vehicle cannot be seen, only the light source of the headlight pair can be seen, and the vehicle target distance cannot be obtained by 2D and 3D joint annotation. How to achieve vehicle distance detection based on the headlight pair only through visual image processing methods.

[0004] Accordingly, a new solution is needed in the art to solve the above problems. Summary of the invention

[0005] The present invention aims to solve or partially solve the above technical problem, that is, how to realize vehicle distance detection based on headlight pairs in night scenes only by visual image processing methods.

[0006] In a first aspect, the present invention provides a distance detection method, the method comprising:

[0007] Acquire vehicle images through a vehicle-mounted camera;

[0008] Based on the vehicle image, obtaining a headlight pair feature map through a trained offset acquisition model, wherein the headlight pair feature map includes a headlight point in the vehicle image and an offset of a predicted paired headlight point corresponding to the headlight point;

[0009] Obtaining a target headlight pair based on the headlight point and an offset of a predicted paired headlight point corresponding to the headlight point;

[0010] Based on the target pair of headlights, in combination with a preset headlight pair distance and a camera intrinsic parameter of the vehicle-mounted camera, the distance between the target pair of headlights and the vehicle-mounted camera is obtained.

[0011] In one embodiment of the above distance detection method, “obtaining the distance between the target headlight pair and the vehicle-mounted camera based on the target headlight pair, in combination with a preset headlight pair distance and a camera intrinsic parameter of the vehicle-mounted camera” includes:

[0012] Obtaining a headlight pair pixel-level distance w of the target headlight pair in the vehicle image according to the target headlight pair;

[0013] According to the pixel-level distance w of the headlight pair, the preset headlight pair distance D and the camera internal parameter c, the distance d=D*w / c between the target headlight pair and the vehicle-mounted camera is obtained.

[0014] In one embodiment of the distance detection method, “obtaining a target headlight pair based on the offset between the headlight point and the predicted paired headlight point corresponding to the headlight point” includes:

[0015] Construct matching cost function cost AB =(D A′B +D AB′ ) / D AB ;

[0016] According to the matching cost function, a matching cost function value between any two vehicle light points among all the vehicle light points is obtained;

[0017] Based on the matching cost function value, obtaining the target headlight pair from all the headlight points by using a Hungarian matching algorithm;

[0018] Among them, cost AB is the matching cost function value between headlight point A and headlight point B,

[0019] The vehicle light point A and the vehicle light point B are any two vehicle light points among all the vehicle light points.

[0020] A′ is the predicted paired vehicle light point corresponding to the vehicle light point A, and the position of A′ is determined according to the position of the vehicle light point A and the offset of the predicted paired vehicle light point corresponding to the vehicle light point A.

[0021] B′ is the predicted paired vehicle light point corresponding to the vehicle light point B, and the position of B′ is determined according to the position of the vehicle light point B and the offset of the predicted paired vehicle light point corresponding to the vehicle light point B.

[0022] D A′B is the distance between the predicted paired headlight point A′ and the headlight point B,

[0023] D AB′ is the distance between the vehicle light point A and the predicted paired vehicle light point B′,

[0024] D AB is the distance between the headlight point A and the headlight point B.

[0025] In one embodiment of the above distance detection method, the headlight pair feature map further includes headlight point classification features, and the headlight point classification features include headlight points and taillight points;

[0026] “According to the matching cost function, obtaining a matching cost function value between any two vehicle light points among all the vehicle light points” also includes:

[0027] According to the matching cost function, respectively obtaining matching cost function values ​​of all the headlight points and / or all the taillight points;

[0028] “Based on the matching cost function value, obtaining the target headlight pair from all the headlight points by using the Hungarian matching algorithm” also includes:

[0029] Based on the matching cost function values ​​of all the headlight points, obtaining a target headlight pair from all the headlight points by using a Hungarian matching algorithm;

[0030] And / or, based on the matching cost function values ​​of all the taillight points, a target taillight pair is obtained from all the taillight points by using a Hungarian matching algorithm.

[0031] In one embodiment of the above distance detection method, the method further includes:

[0032] If the matching cost function value between the two headlight points of the target headlight pair is less than or equal to a preset cost threshold; and the angle between the line between the two headlight points of the target headlight pair in the vehicle image and the horizontal direction is less than or equal to a preset inclination threshold, then the detection result of the target headlight pair is determined to be correct.

[0033] In one embodiment of the above distance detection method, the method further includes:

[0034] Training the offset acquisition model using a smooth L1 regression loss function using training samples;

[0035] The training samples include labeled sample headlight pairs and normalized offsets between two headlight points of the sample headlight pairs, and the sample headlight pairs include headlight pairs and / or taillight pairs;

[0036] The normalized offset includes a normalized horizontal offset and a normalized vertical offset, and the specific method includes:

[0037] Respectively obtain the horizontal offset and the vertical offset of two headlight points in the sample headlight pair in the headlight pair feature map;

[0038] The horizontal offset and the vertical offset are respectively divided by the length of the headlight pair feature map in the corresponding direction to obtain the normalized horizontal offset and the normalized vertical offset.

[0039] In a second aspect, the present invention provides a vehicle high beam control method, the method comprising:

[0040] The distance between the target pair of headlights and the vehicle-mounted camera is obtained according to the distance detection method described in any of the above schemes; the vehicle-mounted camera is set on a first vehicle, the target dual headlights are located on a second vehicle, and the distance between the target pair of headlights and the vehicle-mounted camera is the vehicle-to-vehicle distance between the first vehicle and the second vehicle;

[0041] Obtaining vehicle light point classification features through a trained offset calculation model, wherein the vehicle light point classification features include headlight points and taillight points;

[0042] According to the classification feature of the vehicle light points, the target vehicle light pair is obtained as a target headlight pair or a target taillight pair;

[0043] If the target vehicle light pair is the target headlight pair, when the vehicle-to-vehicle distance is less than a first vehicle-to-vehicle distance threshold, turning off the vehicle high beam of the first vehicle and / or issuing a first prompt message;

[0044] If the target vehicle light pair is the target tail vehicle light pair, when the vehicle-to-vehicle distance is less than a second vehicle-to-vehicle distance threshold, turning off the vehicle high beam of the first vehicle and / or issuing a second prompt message;

[0045] The first vehicle distance threshold is greater than the second vehicle distance threshold.

[0046] In a third aspect, the present invention provides an electronic device comprising a processor and a memory, wherein the memory is suitable for storing a plurality of program codes, and the program codes are suitable for being loaded and run by the processor to execute the distance detection method or the vehicle high beam control method described in any one of the above schemes.

[0047] In a fourth aspect, the present invention provides a storage medium, which is suitable for storing multiple program codes, and the program codes are suitable for being loaded and run by a processor to execute the distance detection method or vehicle high beam control method described in any of the above schemes.

[0048] In a fifth aspect, the present invention provides a vehicle, comprising the electronic device described above.

[0049] The present invention processes the preprocessed vehicle image through the trained offset acquisition model to obtain a headlight point feature map including the headlight point, the offset of the predicted paired headlight point corresponding to the headlight point, and the classification feature of the headlight point. The target headlight pair in the headlight point feature map is obtained through the Hungarian matching algorithm, and then the headlight pair pixel-level distance of the two headlight points of the target headlight pair in the vehicle image is obtained according to the target headlight pair; the distance between the target headlight pair and the camera is obtained according to the headlight pair pixel-level distance, the preset headlight pair distance and the camera focal length, thereby obtaining the required vehicle-to-vehicle distance. In the technical solution of the present invention, the learning ability of the neural network model is utilized to improve the accuracy of the headlight pair detection; by introducing the preset headlight pair distance, the calculation of the vehicle-to-vehicle distance is greatly simplified. Therefore, the present invention provides a simple and reliable solution for vehicle-to-vehicle distance detection only through visual image processing at night, and has high practicality. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The embodiments of the present invention are described below in conjunction with the accompanying drawings, in which:

[0051] Figure 1 It is a flow chart of main steps of the distance detection method according to an embodiment of the present invention.

[0052] Figure 2 Schematic diagram of a characteristic diagram of a headlight pair according to an embodiment of the present invention.

[0053] Figure 3 Schematic diagram of the distance calculation principle between the target headlight pair and the vehicle-mounted camera according to an embodiment of the present invention. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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 part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0055] It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention. Those skilled in the art may make adjustments to them as needed to adapt to specific application scenarios.

[0056] Read First Figure 1 , Figure 1 FIG. 1 is a flow chart of the main steps of the distance detection method according to an embodiment of the present invention. Figure 1 As shown, the distance detection method of the present invention includes:

[0057] Step S101: Acquire a vehicle image through a vehicle-mounted camera;

[0058] Step S102: Based on the vehicle image, a headlight pair feature map is obtained by using a trained offset acquisition model;

[0059] Step S103: obtaining a target headlight pair based on the headlight point and the offset of the predicted paired headlight point corresponding to the headlight point;

[0060] Step S104: Based on the target headlight pair, the distance between the target headlight pair and the vehicle-mounted camera is obtained in combination with a preset headlight pair distance and the camera intrinsic parameter of the vehicle-mounted camera.

[0061] In an embodiment of the present invention, a vehicle-mounted camera facing the vehicle is installed on the first vehicle. In step S101, when driving at night, a vehicle image in front of the vehicle can be obtained through the vehicle-mounted camera.

[0062] In step S102, the vehicle image is usually first preprocessed to obtain an image to be processed whose image size, image color storage format, etc. meet the requirements of the offset acquisition model input. The image preprocessing methods include geometric scaling, color space conversion to RGB color space, filling, color normalization, etc. Those skilled in the art can select one or more methods to preprocess the vehicle image according to the image size, image aspect ratio, data processing speed requirements, etc. of the image to be processed input by the offset acquisition model.

[0063] As an example, when the aspect ratio of the vehicle image is different from that of the image to be processed, the vehicle image can be padded first to make the aspect ratio of the padded vehicle image consistent with that of the image to be processed, and then the image can be scaled proportionally. In addition, in order to increase the speed of image processing, each pixel can be color normalized.

[0064] After the vehicle image is preprocessed, the image to be processed is obtained. The image to be processed is input into the trained offset acquisition model to extract the headlight pair information in the vehicle image and obtain the headlight pair feature map. The information in the headlight pair feature map includes: all headlight points, the offset of the predicted paired headlight point corresponding to each headlight point, and the headlight point classification features of each headlight point. The headlight point classification features include the headlight point and the taillight point.

[0065] The specific model structure of the offset acquisition model in step S102 is not limited in the embodiment of the present invention. For example, the offset acquisition model can be implemented by using a ResNet network, a HRNet network, etc. Those skilled in the art can select a suitable technical solution according to actual conditions.

[0066] like Figure 2In the schematic diagram of the headlight pair feature map shown, the upper left vertex of the headlight pair feature map is selected as the coordinate origin, and a pixel coordinate system of the headlight pair feature map is established, wherein the u-axis direction is the horizontal direction and the v-axis direction is the vertical direction. Figure 2 In the figure, points A, B, C, D, E, F, and G are the headlight points obtained by the offset acquisition model, as well as the position of each headlight point in the headlight point feature map. For example, the position coordinates of headlight point A are A(u A ,v A ), the position coordinate of the light point B is B(u B ,v B ).

[0067] At the same time, the information of the headlight pair feature map also includes the offset of the predicted paired headlight point corresponding to each headlight point. Figure 2 The offset ΔU of the predicted paired light point A' corresponding to the light point A shown in FIG. A and ΔV A .

[0068] Continue reading Figure 2 The implementation process of step S103 is described by referring to the vehicle light point A and the vehicle light point B. Figure 2 As shown, ΔU A is the horizontal offset of the predicted paired light point A' corresponding to the light point A, ΔV A is the vertical offset of the predicted paired light point A' corresponding to the light point A. According to the position of the light point A, combined with ΔU A and ΔV A The predicted paired light point A' can be obtained by looking at the position A' (u A +ΔU A ,v A +ΔV A ). In the same way, according to the position of the headlight point B, the horizontal offset ΔU of the predicted paired headlight point corresponding to the headlight point B is calculated. B and the vertical offset ΔV B , we can get the position B′(u B -ΔU B , v B -ΔV B ).

[0069] Substitute the coordinate data of headlight point A and headlight point B into the constructed matching cost function, and the calculation formula of the matching cost function value between headlight point A and headlight point B is obtained as follows:

[0070] cost AB =(D A′B +D AB′ ) / D AB

[0071] In the formula, cost AB is the matching cost function value between headlight point A and headlight point B,

[0072] D A′B To predict the distance between paired headlight point A′ and headlight point B, D AB′ is the distance between the headlight point A and the predicted paired headlight point B′, D AB is the distance between headlight point A and headlight point B.

[0073] In this embodiment, the distance calculation method is:

[0074]

[0075]

[0076]

[0077] According to the above formula, D A′B , D AB′ and D AB , you can get the matching cost function value cost between the headlight point A and the headlight point B AB Referring to the above calculation method, the matching cost function value between all the headlight points is obtained.

[0078] Construct a set 1 and a set 2 of headlight points, both of which contain all the headlight points: A, B, C, D, E, F, and G. Based on the matching cost function value between any two headlight points in the headlight pair feature graph, the headlight points in set 1 and set 2 are paired using the Hungarian matching algorithm to obtain an optimal matching solution, which contains one or more groups of paired headlight points, thereby obtaining one or more target headlight pairs. As an example, the optimal matching solution contains a group of paired headlight points A and B, and a target headlight pair consisting of headlight point A and headlight point B is obtained.

[0079] It should be noted that during the operation of the Hungarian matching algorithm, the matching process of the same headlight point in set 1 and set 2 will occur. At this time, the matching cost function value of the same headlight point can be pre-set to a very large number, which is much larger than the matching cost function value of any two different headlight points, so that the optimal matching result does not include the pairing result of the same headlight point. AA =cost BB =…=cost FF =cost GG , whose value is the largest positive number of the data type that can be set to match the cost function value definition.

[0080] Preferably, after obtaining the detection result of the target headlight pair, in order to further verify the correctness of the target headlight pair and reduce the occurrence of false detection, the target headlight pair can be verified according to the matching cost function value and the angle between the connecting line between the two headlight points of the target headlight pair and the horizontal direction. The deviation between the predicted paired headlight points output by the model and the actual headlight points is tested by a preset cost threshold. The smaller the matching cost function value, the smaller the deviation. The preset inclination angle threshold is used to test whether the connecting line between the two headlight points of the target headlight pair is horizontal and whether it conforms to the situation in the actual scene that the connecting line of the vehicle headlight pair is parallel to the ground.

[0081] If the matching cost function value between the two headlight points of the target headlight pair is less than or equal to the preset cost threshold; and the angle between the line between the two headlight points of the target headlight pair in the vehicle image and the horizontal direction is less than or equal to the preset inclination threshold, then the detection result of the target headlight pair is determined to be correct, otherwise, the detection result of the target headlight pair is incorrect. As an example, the preset cost threshold can be set to 0.2, and the preset inclination threshold can be set to 10°.

[0082] After the target headlight pair is obtained, the target headlight pair can be subdivided into a target headlight pair and a target taillight pair according to the headlight point classification characteristics.

[0083] In step S104, the position of the target headlight pair in the headlight pair feature map first needs to be mapped to the vehicle image. Since the image aspect ratio of the vehicle image, the image to be processed, and the headlight pair feature map remains unchanged during the data processing process, the position of the same headlight point in each image can be determined by scaling the image.

[0084] In the same way, the pixel coordinate system of the vehicle image is established. After the positions of the two headlight points of the target headlight pair in the vehicle image are obtained, the headlight pair pixel-level distance of the target headlight pair in the vehicle image can be obtained.

[0085] According to the pinhole imaging principle, the pixel-level distance w of the headlight pair, the camera internal parameter c, the actual width D of the headlight pair, and the distance d between the target headlight pair and the vehicle-mounted camera exist as follows: Figure 3 As shown in the relationship, D / d=w / c, where the camera intrinsic parameter c is the camera focal length.

[0086] For some application scenarios, such as automatic control of high beams at night for vehicle assisted driving, the distance measurement does not require very high accuracy. At this time, the average width of the headlights of most vehicles is referred to, and the actual width D of the headlights is set to a fixed value, that is, the preset headlight distance D = 1.86 meters in the embodiment of the present invention, to simplify the distance detection process and achieve fast calculation.

[0087] When the pixel-level distance w of the headlight pair, the camera internal parameter c, and the preset headlight pair distance D are known, the distance d between the target headlight pair and the vehicle-mounted camera can be obtained according to d=D*w / c. Since the vehicle-mounted camera is installed on the first vehicle and the target headlight pair is the headlight of the second vehicle, the distance d between the target headlight pair and the vehicle-mounted camera can be used as the vehicle-to-vehicle distance between the first vehicle and the second vehicle.

[0088] In another preferred embodiment of the present invention, the relevant processing process in step 103 can be optimized according to the classification features of the vehicle light points obtained in step S102.

[0089] In step 102, the headlight point classification feature of each headlight point may be obtained, and the headlight point classification feature may be used to distinguish whether the headlight point is a headlight point or a taillight point.

[0090] At this time, the optimized step S103 includes: respectively obtaining the matching cost function values ​​of all headlight points and / or all taillight points, that is, the headlight points with different classification features do not calculate the matching cost function values ​​for each other.

[0091] As an example, Figure 2 The headlight points A, B, C, and D are the headlight points, and the headlight points E, F, and G are the taillight points. At this time, the matching cost function values ​​of any two headlight points among the headlight points A, B, C, and D, and the matching cost function values ​​of any two taillight points among the taillight points E, F, and G are calculated respectively, and the matching cost function value between the headlight point A and the headlight point E will not be calculated again.

[0092] The optimized step S103 also includes: pairing all headlight points and all taillight points respectively by using the Hungarian matching algorithm to obtain target headlight pairs among all headlight points (target headlight pairs) and target headlight pairs among all taillight points (i.e., target headlight pairs).

[0093] By distinguishing between the headlight points and the taillight points, the calculation amount of the matching cost function value and the amount of operation of the Hungarian matching algorithm can be reduced, thereby improving the data processing speed; and according to the actual situation, it is limited that the headlight points and the taillight points are not allowed to be paired, which can avoid the mispairing between the headlight points and the taillight points, thereby improving the accuracy of the headlight pair detection.

[0094] Before the offset acquisition model is used, it is necessary to train the offset acquisition model using the smooth L1 regression loss function through training samples.

[0095] The sample image is a vehicle image that has been annotated. In the embodiment of the present invention, the annotated content includes: a sample headlight pair ID, a sample headlight point classification feature, and a normalized offset between two sample headlight points in the sample headlight pair.

[0096] The classification features of the sample headlight points are also divided into headlight points and taillight points. The normalized offset includes the normalized horizontal offset and the normalized vertical offset. The method for obtaining the normalized offset is:

[0097] Obtain the horizontal and vertical offsets of two sample headlight points in the sample headlight pair in the headlight pair feature map respectively;

[0098] Divide the horizontal offset by the length of the headlight pair feature map in the horizontal direction to obtain the normalized horizontal offset;

[0099] The vertical offset is divided by the length of the headlight pair feature map in the vertical direction to obtain the normalized vertical offset.

[0100] It should be noted that image preprocessing methods (converting color space into RGB color space, filling, color normalization, etc.), ResNet network, HRNet network, model training using smooth L1 regression loss function, etc. are all commonly used image processing, feature extraction, and data matching methods by technicians in this field, and will not be repeated here.

[0101] Furthermore, the present invention also provides a vehicle high beam control method, wherein the distance between the target pair of headlights and the vehicle-mounted camera is obtained according to the above-mentioned distance detection method, the vehicle-mounted camera is set on a first vehicle, and the target dual headlights are located on a second vehicle. Accordingly, the distance between the target pair of headlights and the vehicle-mounted camera is the vehicle-to-vehicle distance between the first vehicle and the second vehicle.

[0102] According to the classification characteristics of the headlight points (headlight points and taillight points), the target headlight pairs can be subdivided into target headlight pairs or target taillight pairs.

[0103] If the target vehicle light pair is the target headlight pair, it means that the two vehicles are traveling in the opposite direction. When the distance between the vehicles is less than the first vehicle distance threshold, the vehicle high beam is turned off and / or a first prompt message is issued. For example, the content of the first prompt includes: oncoming vehicle, please turn off the vehicle high beam. The information prompt method is preferably an audio device in the vehicle.

[0104] If the target vehicle light pair is the target tail light pair, it means that the two vehicles are traveling in the same direction. When the distance between the two vehicles is less than the second vehicle distance threshold, the vehicle high beam is turned off and / or a second prompt message is issued. For example, the second prompt includes: same-direction vehicle, please turn off the vehicle high beam. The information prompt method is preferably an audio device in the vehicle.

[0105] The first vehicle distance threshold is usually set to be greater than the second vehicle distance threshold because, under the same distance, the impact of the high beam of a vehicle traveling in the opposite direction on the driver is greater than the impact of the high beam of a vehicle traveling in the same direction on the driver. As an example, the first vehicle distance threshold is set to 600 meters and the second vehicle distance threshold is set to 300 meters.

[0106] Furthermore, the present invention also provides a storage medium, which can be configured to store a program for executing the distance detection method or vehicle high beam control method of the above method embodiment, and the program can be loaded and run by a processor to implement the above distance detection method or vehicle high beam control method. For ease of explanation, only the part related to the embodiment of the present invention is shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The storage medium can be a storage device formed by various electronic devices. Optionally, the storage medium in the embodiment of the present invention is a non-temporary readable and writable storage medium.

[0107] Furthermore, the present invention also provides an electronic device, which includes a processor, and the processor can be configured to execute instructions to implement the distance detection method or vehicle high beam control method of the above method embodiment. For ease of explanation, only the part related to the embodiment of the present invention is shown, and for specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The target detection device can be a control device device formed by various electronic devices.

[0108] Furthermore, the present invention also provides a vehicle, the vehicle includes the above electronic device, the electronic device includes a processor, and the processor can be configured to execute instructions to implement the distance detection method or vehicle high beam control method of the above method embodiment. Optionally, the vehicle is a new energy vehicle with an on-board camera and an assisted driving function.

[0109] Those skilled in the art should be able to appreciate that the method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of electronic hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in electronic hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0110] It should be noted that the terms "first", "second", and other ordinal numbers in the specification and claims of the present invention and the above-mentioned drawings are only used to distinguish similar objects, rather than to describe or indicate a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein.

[0111] In addition, in the description of the present application, the term "A and / or B" represents all possible combinations of A and B, such as only A, only B, or A and B.

[0112] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. A distance detection method, characterized in that: The method comprises: Acquire vehicle images through a vehicle-mounted camera; Based on the vehicle image, obtaining a headlight pair feature map through a trained offset acquisition model, wherein the headlight pair feature map includes a headlight point in the vehicle image and an offset of a predicted paired headlight point corresponding to the headlight point; Obtaining a target headlight pair based on the headlight point and an offset of a predicted paired headlight point corresponding to the headlight point; Based on the target headlight pair, the distance between the target headlight pair and the vehicle-mounted camera is obtained in combination with a preset headlight pair distance and a camera intrinsic parameter of the vehicle-mounted camera; Wherein, "obtaining a target headlight pair based on the headlight point and the offset of the predicted paired headlight point corresponding to the headlight point" includes: Construct matching cost function cost AB =(D A′B +D AB′ ) / D AB ; According to the matching cost function, a matching cost function value between any two vehicle light points among all the vehicle light points is obtained; Based on the matching cost function value, obtaining the target headlight pair from all the headlight points by using a Hungarian matching algorithm; Among them, cost AB is the matching cost function value between headlight point A and headlight point B, The vehicle light point A and the vehicle light point B are any two vehicle light points among all the vehicle light points. A′ is the predicted paired vehicle light point corresponding to the vehicle light point A, and the position of A′ is determined according to the position of the vehicle light point A and the offset of the predicted paired vehicle light point corresponding to the vehicle light point A. B′ is the predicted paired vehicle light point corresponding to the vehicle light point B, and the position of B′ is determined according to the position of the vehicle light point B and the offset of the predicted paired vehicle light point corresponding to the vehicle light point B. D A′B is the distance between the predicted paired headlight point A′ and the headlight point B, D AB′ is the distance between the vehicle light point A and the predicted paired vehicle light point B′, D AB is the distance between the headlight point A and the headlight point B.

2. The distance detection method according to claim 1, characterized in that: “Based on the target headlight pair, in combination with a preset headlight pair distance and the camera intrinsic parameter of the vehicle-mounted camera, obtaining the distance between the target headlight pair and the vehicle-mounted camera” includes: Obtaining a headlight pair pixel-level distance w of the target headlight pair in the vehicle image according to the target headlight pair; According to the pixel-level distance w of the headlight pair, the preset headlight pair distance D and the camera internal parameter c, the distance d=D*w / c between the target headlight pair and the vehicle-mounted camera is obtained.

3. The distance detection method according to claim 1, characterized in that: The vehicle light pair feature map further includes a vehicle light point classification feature, and the vehicle light point classification feature includes a headlight point and a taillight point; “According to the matching cost function, obtaining a matching cost function value between any two of all the vehicle light points” also includes: According to the matching cost function, respectively obtaining matching cost function values ​​of all the headlight points and / or all the taillight points; “Based on the matching cost function value, obtaining the target headlight pair from all the headlight points by using the Hungarian matching algorithm” also includes: Based on the matching cost function values ​​of all the headlight points, obtaining a target headlight pair from all the headlight points by using a Hungarian matching algorithm; And / or, based on the matching cost function values ​​of all the taillight points, a target taillight pair is obtained from all the taillight points by using a Hungarian matching algorithm.

4. The distance detection method according to claim 3, characterized in that: The method further comprises: If the matching cost function value between the two headlight points of the target headlight pair is less than or equal to a preset cost threshold; and the angle between the line between the two headlight points of the target headlight pair in the vehicle image and the horizontal direction is less than or equal to a preset inclination threshold, then the detection result of the target headlight pair is determined to be correct.

5. The distance detection method according to any one of claims 1 to 4, characterized in that: The method further comprises: Training the offset acquisition model using a smooth L1 regression loss function using training samples; The training samples include labeled sample headlight pairs and normalized offsets between two headlight points of the sample headlight pairs, and the sample headlight pairs include headlight pairs and / or taillight pairs; The normalized offset includes a normalized horizontal offset and a normalized vertical offset, and the specific method includes: Respectively obtain the horizontal offset and the vertical offset of two headlight points in the sample headlight pair in the headlight pair feature map; The horizontal offset and the vertical offset are respectively divided by the length of the headlight pair feature map in the corresponding direction to obtain the normalized horizontal offset and the normalized vertical offset.

6. A vehicle high beam control method, characterized in that: The method comprises: The distance detection method according to any one of claims 1 to 5 obtains the distance between the target pair of headlights and the vehicle-mounted camera; the vehicle-mounted camera is set on a first vehicle, the target pair of headlights is located on a second vehicle, and the distance between the target pair of headlights and the vehicle-mounted camera is the vehicle-to-vehicle distance between the first vehicle and the second vehicle; Obtaining vehicle light point classification features through a trained offset calculation model, wherein the vehicle light point classification features include headlight points and taillight points; According to the classification feature of the vehicle light points, the target vehicle light pair is obtained as a target headlight pair or a target taillight pair; If the target vehicle light pair is the target headlight pair, when the vehicle-to-vehicle distance is less than a first vehicle-to-vehicle distance threshold, turning off the vehicle high beam of the first vehicle and / or issuing a first prompt message; If the target vehicle light pair is the target tail vehicle light pair, when the vehicle-to-vehicle distance is less than a second vehicle-to-vehicle distance threshold, turning off the vehicle high beam of the first vehicle and / or issuing a second prompt message; The first vehicle distance threshold is greater than the second vehicle distance threshold.

7. An electronic device, comprising a processor and a memory, wherein the memory is suitable for storing a plurality of program codes, wherein: The program code is suitable for being loaded and run by the processor to execute the distance detection method according to any one of claims 1 to 5 or the vehicle high beam control method according to claim 6.

8. A storage medium, the storage medium being suitable for storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by a processor to execute the distance detection method according to any one of claims 1 to 5 or the vehicle high beam control method according to claim 6.

9. A vehicle, characterized in that: The vehicle comprises the electronic device according to claim 7.

Citation Information

Patent Citations

  • Method and device for calculating relative distance between vehicles

    CN102865824A

  • Method for tracking and identifying headlight and taillight of automobile under visual perception

    CN106934808A