Distance measurement method and electronic device

CN122590797APending Publication Date: 2026-08-18SHENZHEN STREAMING VIDEO TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610730082.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-25
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0003]本发明的目的是提供一种距离测量方法及电子设备,可融合不同测距算法的优势进行距离测量,从而解决单目视觉测距稳定度、可靠度较低的问题

Benefits of technology

[0015]The beneficial effects of this invention are as follows: First, this invention can use at least two distance measurement algorithms to determine the predicted distance value and uncertainty of the target object in the image under test. The uncertainty is set according to the prediction confidence level determined by the distance measurement algorithm, or according to at least two predicted distance values ​​determined by the distance measurement algorithm, and can characterize the reliability of the predicted distance value. Subsequently, this invention can determine the fusion weight corresponding to each predicted distance value based on the uncertainty, and can fuse each predicted distance value according to each fusion weight. This allows for the use of different methods to determine the predicted distance value, avoiding the limitation of distance measurement by a single ranging method. Simultaneously, fusing predicted distance values ​​determined by multiple methods according to the uncertainty can improve the contribution of more accurate predicted distance values ​​and reduce the contribution of less accurate predicted distance values. Therefore, it can integrate the advantages of different ranging algorithms for distance measurement, improving the stability and reliability of distance measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122590797A_ABST
    Figure CN122590797A_ABST
Patent Text Reader

Abstract

The application provides a distance measurement method and an electronic device, and relates to the field of visual perception. The method comprises the following steps: acquiring distance prediction values and uncertainties of a target object in a to-be-measured image determined by at least two distance measurement algorithms; wherein the uncertainty is set according to a prediction confidence determined by the distance measurement algorithm or is set according to at least two distance prediction values determined by the distance measurement algorithm; determining a fusion weight corresponding to each distance prediction value according to the uncertainty; and fusing each distance prediction value according to each fusion weight to obtain a distance measurement value. The distance prediction values of multiple distance measurement algorithms can be fused according to the uncertainty, so that the advantages of different ranging algorithms are fused for distance measurement, and the stability and reliability of monocular visual ranging can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of visual perception, and in particular to a distance measurement method and electronic device. Background Technology

[0002] In related technologies, monocular vision ranging generally uses a single ranging method, which is easily limited by the single ranging method. Furthermore, it lacks redundancy when the ranging method fails or its accuracy decreases, resulting in unstable and unreliable ranging output. Summary of the Invention

[0003] The purpose of this invention is to provide a distance measurement method and electronic device that can integrate the advantages of different ranging algorithms to perform distance measurement, thereby solving the problems of low stability and reliability of monocular vision ranging.

[0004] To solve the above-mentioned technical problems, the present invention provides a distance measurement method, comprising: Obtain distance prediction values ​​and uncertainties for target objects in the image under test determined by at least two distance measurement algorithms; wherein the uncertainty is set according to the prediction confidence determined by the distance measurement algorithm, or according to at least two distance prediction values ​​determined by the distance measurement algorithm; The fusion weights corresponding to each of the distance prediction values ​​are determined based on the uncertainty. The distance prediction values ​​are fused according to the fusion weights to obtain the distance measurement values.

[0005] Optionally, the distance prediction value and uncertainty determined by the distance measurement algorithm for the target object in the image under test are obtained, including: Obtain the predicted height and height variance of the target object detection box determined by the distance measurement algorithm; The distance prediction value is determined based on the height prediction value and the preset camera parameter value; The uncertainty is determined based on the predicted height value, the height variance value, and the preset camera parameter value.

[0006] Optionally, the distance prediction value and uncertainty determined by the distance measurement algorithm for the target object in the image under test are obtained, including: Obtain the depth prediction, scale factor prediction, and scale factor uncertainty of the area where the target object is located by the distance measurement algorithm; The distance prediction value is determined based on the depth prediction value and the scale factor prediction value; The depth variance is determined based on the depth prediction value, and the uncertainty is determined based on the depth variance value, the scale factor prediction value, and the scale factor uncertainty.

[0007] Optionally, the distance prediction value and uncertainty determined by the distance measurement algorithm for the target object in the image under test are obtained, including: Obtain the predicted coordinates and prediction confidence level of the grounding point of the target object determined by the distance measurement algorithm; The distance prediction value is determined based on the predicted coordinates and preset camera parameters; The uncertainty is determined based on the predicted confidence level and the preset basic variance.

[0008] Optionally, it also includes: Determine the deviation value between the distance prediction values, determine the abnormal distance prediction value based on the deviation value, and remove the abnormal distance prediction value; Determine whether the number of remaining distance prediction values ​​meets the preset quantity requirement; If satisfied, the fusion weight is determined based on the uncertainty of the remaining distance prediction value, and the remaining distance prediction values ​​are fused according to each of the fusion weights to obtain the distance measurement value; If the conditions are not met, the distance measurement value is determined based on the valid distance prediction value among the remaining distance prediction values, or based on the historical distance prediction value, or exception handling is performed.

[0009] Optionally, determining the deviation value between the predicted distance values ​​and determining the abnormal distance predicted value based on the deviation value includes: Determine the first deviation value between the predicted distance values; If the first deviation between the predicted distance value and a preset number of other predicted distance values ​​is greater than a first preset threshold, then the predicted distance value is marked as a first abnormal predicted distance value. A second deviation value is determined between the predicted distance value and the measured distance value, and a normalized residual value is determined based on the second deviation value and the uncertainty of the predicted distance value; If the normalized residual value is greater than the second preset threshold, the distance prediction value is marked as the second abnormal distance prediction value. The removal of the abnormal distance prediction value includes: Remove the first abnormal distance prediction value and determine whether the remaining distance prediction values ​​contain the second abnormal distance prediction value; If included, remove the second outlier distance prediction with the largest normalized residual value.

[0010] Optionally, determining the distance measurement value based on the valid distance prediction values ​​among the remaining distance prediction values ​​includes: The distance prediction value with the lowest uncertainty among the remaining distance prediction values ​​is taken as the effective distance prediction value, and the effective distance prediction value is taken as the distance measurement value.

[0011] Optionally, the distance measurement value is determined based on historical distance prediction values. Obtain historical distance prediction values ​​and distance change rates determined based on the historical distance prediction values; The distance measurement value is determined based on the historical distance prediction value, the distance change rate, and the inter-frame time interval.

[0012] Optionally, the distance measurement value is determined based on the valid distance prediction values ​​among the remaining distance prediction values, or based on historical distance prediction values, or anomaly handling is performed, including: The degradation level of the current image to be tested is set according to the target information; wherein, the target information is any one or more of the following: the number of remaining distance prediction values, the fusion uncertainty of the distance measurement values, the degradation level of historical images to be tested, and the fusion uncertainty of distance measurement values ​​in historical images to be tested, and the fusion uncertainty is determined based on the uncertainty of the distance prediction values; Depending on the downgrade level, the distance measurement value may be determined based on the effective distance prediction value among the remaining distance prediction values, or based on the historical distance prediction values, or exception handling may be performed.

[0013] The present invention also provides an electronic device, comprising: Memory, used to store computer programs; A processor is used to implement the steps of the distance measurement method described above when executing the computer program.

[0014] This invention provides a distance measurement method, comprising: acquiring distance prediction values ​​and uncertainties determined by at least two distance measurement algorithms for a target object in a test image; wherein the uncertainty is set according to the prediction confidence level determined by the distance measurement algorithms, or according to at least two distance prediction values ​​determined by the distance measurement algorithms; determining a fusion weight corresponding to each of the distance prediction values ​​according to the uncertainty; and fusing the distance prediction values ​​according to the fusion weights to obtain a distance measurement value.

[0015] The beneficial effects of this invention are as follows: First, this invention can use at least two distance measurement algorithms to determine the predicted distance value and uncertainty of the target object in the image under test. The uncertainty is set according to the prediction confidence level determined by the distance measurement algorithm, or according to at least two predicted distance values ​​determined by the distance measurement algorithm, and can characterize the reliability of the predicted distance value. Subsequently, this invention can determine the fusion weight corresponding to each predicted distance value based on the uncertainty, and can fuse each predicted distance value according to each fusion weight. This allows for the use of different methods to determine the predicted distance value, avoiding the limitation of distance measurement by a single ranging method. Simultaneously, fusing predicted distance values ​​determined by multiple methods according to the uncertainty can improve the contribution of more accurate predicted distance values ​​and reduce the contribution of less accurate predicted distance values. Therefore, it can integrate the advantages of different ranging algorithms for distance measurement, improving the stability and reliability of distance measurement.

[0016] The present invention also provides an electronic device that has the above-mentioned beneficial effects. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0018] Figure 1 A flowchart of a distance measurement method provided in an embodiment of the present invention; Figure 2 A flowchart of another distance measurement method provided in an embodiment of the present invention; Figure 3 A flowchart of a correction and degradation process provided in an embodiment of the present invention; Figure 4 A schematic diagram of a distance measurement system provided in an embodiment of the present invention; Figure 5 This is a structural block diagram of a distance measuring device provided in an embodiment of the present invention; Figure 6 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] In related technologies, monocular vision ranging generally uses a single ranging method, which is easily limited by the single ranging method. Furthermore, it lacks redundancy when the ranging method fails or its accuracy decreases, resulting in unstable and unreliable ranging output.

[0021] In view of this, in order to improve the stability and reliability of monocular vision ranging, the present invention can provide a distance measurement method that can integrate the advantages of different ranging algorithms to measure distance, thereby solving the problem of low stability and reliability of monocular vision ranging.

[0022] It should be noted that this embodiment does not limit the hardware device used to execute this method, and can be set according to actual ranging requirements. For example, the hardware device can be a personal terminal device (such as a mobile phone, tablet, etc.). In a specific field, the hardware device can also be a dedicated device in that field. For example, in the field of intelligent driving, the hardware device can be an in-vehicle device.

[0023] Please refer to Figure 1 , Figure 1 A flowchart of a distance measurement method provided in an embodiment of the present invention may include: S10. Obtain the distance prediction value and uncertainty determined by at least two distance measurement algorithms for the target object in the image under test; wherein, the uncertainty is set according to the prediction confidence determined by the distance measurement algorithm, or according to the at least two distance prediction values ​​determined by the distance measurement algorithm.

[0024] The image to be tested refers to an image containing the target object, which can be acquired by an image acquisition device. The target object refers to the object in the image to be tested that needs to be measured at a distance. For example, in an intelligent driving scenario, the target object can be other vehicles, people, obstacles, etc.

[0025] In this embodiment, the measured distance refers to the relative distance between the target object and the measured object, and the measured object refers to the physical object used as the measurement reference. For example, in an intelligent driving scenario, the measured object is the vehicle driven by the user, and the target object is an obstacle; therefore, the measured distance is the distance between the vehicle and the obstacle.

[0026] Distance measurement algorithms refer to algorithms that predict the distance between a target object and a measuring device based on different technical principles. This embodiment sets at least two distance measurement algorithms to leverage the advantages of each, improving the stability, reliability, and redundancy of distance measurement. In one possible scenario, this embodiment can employ a distance measurement method based on the detection box height, a distance measurement method based on a depth estimation network, and a distance measurement method based on key points. The distance measurement method based on the detection box height determines the distance between the target object and the measuring object based on the target object's detection box height, the camera's focal length, and the target's preset physical height. The distance measurement method based on a depth estimation network generates a depth map of the target object's area using a monocular depth estimation network, extracts the relative depth prediction value of the target area from the depth map, and converts the relative depth prediction value into distance using a scale factor. The distance measurement method based on key points detects the pixel coordinates of the contact point between the target object and the ground, and calculates the distance to the target object using trigonometric geometry, combined with the camera's installation height, pitch angle, and focal length. Of course, other distance measurement algorithms can also be set as needed.

[0027] In this embodiment, different distance measurement algorithms will be used to determine the predicted distance between the target object and the measurement object, along with their uncertainty. The predicted distance refers to the distance prediction result between the target object and the measuring device output by the distance measurement algorithm. Uncertainty is a quantitative indicator characterizing the reliability of the predicted distance; a smaller value indicates higher reliability. The uncertainty will subsequently be used to weight and fuse the predicted distances obtained from different distance measurement algorithms, increasing the contribution of more accurate predictions and decreasing the contribution of less accurate predictions, thereby combining the advantages of different distance measurement algorithms for distance measurement.

[0028] It should be noted that this embodiment uses different types of distance measurement algorithms to measure the distance to the same target object in the same test image, and then fuses the distance prediction values ​​obtained from each distance measurement algorithm to obtain the final distance measurement value. Taking a specific scenario as an example, in the field of intelligent driving, for each test image captured by the vehicle camera, the vehicle device executes multiple distance measurement algorithms on that image to obtain multiple distance prediction values ​​and their uncertainties for the target object in the test image. Then, based on the uncertainty, the multiple distance prediction values ​​are fused to obtain the distance measurement value of the target object in the current frame of the test image.

[0029] This embodiment can determine the aforementioned uncertainty in two ways: 1. The uncertainty is set based on the prediction confidence level determined by the distance measurement algorithm. The prediction confidence level is a quantitative representation of the degree of confidence the distance measurement algorithm has in its output results. In this case, the uncertainty is given by the distance measurement algorithm. 2. The uncertainty is set based on at least two distance prediction values ​​determined by the distance measurement algorithm. For example, the variance of at least two distance prediction values ​​can be calculated, and the uncertainty is determined based on the variance. In this case, if these distance prediction values ​​are all reliable, their differences will be small, and therefore the variance should be small; if these distance prediction values ​​are unreliable, their differences will be large, and therefore the variance should be large. It can be seen that through the above methods, this embodiment can effectively determine the uncertainty of the distance prediction values ​​given by the algorithm, thereby facilitating subsequent fusion.

[0030] The following section introduces three methods for determining distance prediction values ​​and uncertainties based on three different distance measurement algorithms.

[0031] In one implementation, obtaining the distance prediction value and uncertainty determined by the distance measurement algorithm for a target object in the image under test may include: S111. Obtain the predicted height and height variance of the target object detection box determined by the distance measurement algorithm.

[0032] In this embodiment, the distance measurement algorithm can be a ranging method based on the height of the detection box. This algorithm can use a target detection network for detection and is suitable for detecting distant targets. This embodiment can set up a corresponding algorithm submodule (which can be called submodule A) to execute the ranging method based on the height of the detection box. The core principle of this algorithm is: to determine the predicted height of the detection box containing the target object, and to determine the distance between the target object and the measured object based on the predicted height, the camera focal length, and the target's preset physical height. Specifically, this embodiment can also require the distance measurement algorithm to provide the height variance value of the detection box. Here, the detection box refers to the rectangular area in the image to be measured that marks the location of the target object; the predicted height refers to the estimated number of pixels occupied by the target object in the vertical direction in the image to be measured; and the height variance value is a statistical measure characterizing the uncertainty of the predicted height value, which can be used to determine the uncertainty.

[0033] Therefore, this embodiment can improve the target detection network to output a probability distribution of the detection box height values, and then determine the average and variance values ​​of the detection box height values ​​based on this probability distribution, which can be expressed as: Average height : As a prediction result of the detection box height; Height variance or equivalent output This indicates the uncertainty of the network's height prediction. To ensure a positive variance, in engineering practice, the network output is usually set to... Then convert it to an exponential function .

[0034] Furthermore, this average value can be used as the predicted height, and this variance value can be used as the height variance. For example, the bounding box height value given by the object detection network can be expressed as: ; in, Indicates the height of the detection frame. Indicates a normal distribution. This represents the predicted mean of the detection box height. This represents the prediction variance of the detection box height.

[0035] S112. Determine the distance prediction value based on the height prediction value and the preset camera parameter values.

[0036] In this embodiment, the preset camera parameter values ​​refer to the pre-calibrated internal geometric characteristics and external mounting posture parameters of the camera, including the camera's longitudinal focal length and the predicted height of the target. Based on the principle of similar triangles in the pinhole camera model, the physical distance between the target object and the measured object can be calculated using the camera's longitudinal focal length, the preset height of the target object, and the predicted height value, which can be expressed as: ; in, The distance prediction value (in meters) output by submodule A; The vertical focal length of the camera (in pixels); Set the target height (in meters); The height of the detection box (in pixels).

[0037] S113. Determine the uncertainty based on the predicted height, the height variance, and the preset camera parameter values.

[0038] In this embodiment, the height variance value can be converted into distance uncertainty using the error propagation formula. The larger the height variance value, the more unstable the detection box height prediction, and the greater the uncertainty obtained after error propagation.

[0039] Uncertainty can be expressed as: ; in, The distance variance (i.e. uncertainty, in meters²) output by submodule A. This represents the height variance value (unit: pixels²).

[0040] In this way, the impact of detection box jitter or false detection on the ranging results can be accurately quantified, enabling the fusion process to automatically reduce the weight contribution of unstable detection boxes and avoid drastic fluctuations in the fusion results caused by detection box jumps.

[0041] It should be noted that, to ensure the object detection network outputs both the predicted height and the height variance, an uncertainty output branch can be added to the detection head of the network. This branch can then be trained using an appropriate loss function, enabling the network to provide the predicted height of the bounding box and its reliability. During training, the object detection network can employ a Gaussian negative log-likelihood loss, allowing it to learn to output a larger variance when there are large height prediction errors, target occlusion, blurred boundaries, or small, distant targets; and a smaller variance when the target is clear and the bounding box is stable.

[0042] In one implementation, obtaining the distance prediction value and uncertainty determined by the distance measurement algorithm for a target object in the image under test may include: S121. Obtain the depth prediction value, scale factor prediction value, and scale factor uncertainty of the area where the target object is located as determined by the distance measurement algorithm; In this embodiment, the distance measurement algorithm can be a ranging method based on a depth estimation network, suitable for near-range target detection. This embodiment can set up a corresponding algorithm submodule (referred to as submodule B) to execute the ranging method based on the depth estimation network. The core principle of this algorithm is: the depth estimation network can be used to generate a depth map and scale factor prediction values ​​for the area where the target object is located; the depth prediction values ​​for the area are extracted from the depth map; and the scale factor prediction values ​​are used to convert the depth prediction values ​​into distance. The area where the target object is located can be determined using a target detection algorithm or an instance segmentation algorithm. The depth prediction value refers to the relative depth prediction result of the target object relative to the measured object, not an absolute distance in meters. The scale factor refers to the scaling factor that converts the relative depth value into an absolute distance, and the scale factor prediction value is the scale factor prediction result output by the depth estimation network.

[0043] Furthermore, since both depth prediction and scale factor prediction affect the final distance prediction result, this embodiment, in addition to determining the uncertainty corresponding to the depth prediction, can also control the uncertainty of the scale factor output by the depth estimation network. Here, scale factor uncertainty refers to a quantitative index characterizing the reliability of the scale factor prediction. Due to the scale ambiguity in monocular depth estimation, the scale factor may be affected by calibration errors, scene type, or time drift, resulting in deviations. Scale factor uncertainty is used to quantify the possible range of such deviations; a larger value indicates lower reliability of the scale conversion.

[0044] S122. Determine the distance prediction value based on the depth prediction value and the scale factor prediction value.

[0045] In this embodiment, the predicted depth values ​​of each pixel within the target object's region can be statistically aggregated, for example, by taking the median, and then multiplied by the predicted scale factor value to obtain the predicted absolute distance between the target object and the measuring device. Specifically, the predicted distance value can be expressed as: ; in, This is the distance prediction value (in meters) output by submodule B. This is the set of depth values ​​in the depth map within the target region. As a scale factor, This is a median function.

[0046] S122. Determine the depth variance value based on the depth prediction value, and determine the uncertainty based on the depth variance value, the scale factor prediction value, and the scale factor uncertainty.

[0047] In this embodiment, the depth variance value is determined based on the depth prediction values ​​of each pixel within the target object's region, and can characterize the dispersion of the depth prediction values. The smaller the depth variance value, the more consistent the depth estimation in that region, and the higher the reliability of the depth prediction values; the larger the depth variance value, the more inconsistent the depth estimation in that region, and the lower the reliability of the depth prediction values, which may correspond to scenes with blurred target boundaries or small targets at a distance.

[0048] After obtaining the depth variance value, this embodiment can use a depth consistency-based method to combine the depth variance value with the scale factor prediction value, and add the scale factor uncertainty to obtain the uncertainty of the distance measurement algorithm, which can be expressed as: ; in, The distance variance (i.e. uncertainty, in meters²) output by submodule B. The uncertainty of the scale factor is expressed in meters.

[0049] This uncertainty setting method can identify unreliable predictions by the depth estimation network in scale-ambiguous scenarios, and automatically reduce the weight of depth estimation anomalies during the fusion process.

[0050] In one implementation, obtaining the distance prediction value and uncertainty determined by the distance measurement algorithm for a target object in the image under test may include: S131. Obtain the predicted coordinates and prediction confidence of the grounding point of the target object determined by the distance measurement algorithm; In this embodiment, the distance measurement algorithm can be a keypoint-based ranging method. This embodiment can set up a corresponding algorithm submodule (referred to as submodule C) to execute the keypoint-based ranging method. Its core principle is: detecting the pixel coordinates of the contact point between the target object and the ground, and combining this with the camera's mounting height, pitch angle, and focal length, calculating the distance to the target object through trigonometric relationships. Here, the contact point refers to the contact position between the target object and the supporting ground. The predicted coordinates refer to the pixel position coordinates of the contact point in the image to be measured. To determine the reliability of the predicted coordinates, the algorithm can also output a prediction confidence score. The prediction confidence score refers to the degree of certainty that the contact point detection algorithm is in predicting the contact point location; its value ranges from 0 to 1, with a higher value indicating more reliable detection. This step, by detecting the contact point between the target object and the ground and combining it with ground plane geometric constraints, performs ranging. It can still work effectively for targets that are partially occluded but whose contact points are visible.

[0051] S132. Determine the distance prediction value based on the predicted coordinates and preset camera parameters.

[0052] In this embodiment, the preset camera parameters can be camera mounting height, pitch angle, and focal length. The horizontal distance from the target object to the camera can be calculated using trigonometric functions based on the image coordinates of the grounding point, camera mounting height, pitch angle, and focal length. The predicted distance can be expressed as: ; in, This is the distance prediction value (in meters) output by submodule C. Installation height of the camera (unit: meters). The camera's tilt angle (in radians). The image y-coordinate of the grounding point (in pixels). The y-coordinate of the principal point of the image (in pixels). The vertical focal length of the camera (unit: pixels).

[0053] S133. Determine the uncertainty based on the prediction confidence level and the preset basic variance.

[0054] In this embodiment, the preset basic variance refers to the baseline value of basic uncertainty obtained through calibration data or historical test statistics. The lower the prediction confidence, the less reliable the grounding point detection, and the greater the corresponding uncertainty. This uncertainty setting method can quantify the impact of grounding point detection error on the ranging result. When the target is occluded, causing the grounding point to become blurred, the uncertainty is automatically increased, reducing the weight of the algorithm in the fusion and avoiding erroneous contributions in occluded scenarios. The uncertainty can be expressed as: ; in, Let be the distance variance (i.e., uncertainty, in meters²) of submodule C. The basic variance (unit: meters², preset value, the value can be set arbitrarily, for example, 1.0). The confidence level for grounding point detection (value range 0-1).

[0055] S20. Determine the fusion weights corresponding to each distance prediction value based on the uncertainty.

[0056] In this embodiment, the fusion weight refers to the coefficient used to weight and fuse the various distance predictions, reflecting the importance of each distance prediction in the fusion process. The lower the uncertainty of a distance prediction, the greater its corresponding fusion weight, thus allowing high-confidence predictions to occupy a larger proportion in the fusion result. This adaptive weighting method does not require manual pre-setting of fixed weights and can be dynamically adjusted according to changes in the scene, making the fusion process more flexible.

[0057] The fusion weights corresponding to each algorithm submodule It can be represented as: ; in, For the first The weight of each submodule, To prevent the variance from being too small and causing the weights to become infinitely large, a stability constant (unit: m², for example) is required. ).

[0058] S30. Based on each fusion weight, fuse the predicted distance values ​​to obtain the measured distance value.

[0059] In this embodiment, the distance measurement value refers to the final distance result obtained after weighted fusion. The fusion process can be implemented using a weighted average method, which involves multiplying each distance prediction value by its fusion weight, summing the results, and then dividing by the sum of the fusion weights.

[0060] It has The first ranging submodule, the... Each submodule outputs distance and variance The fused distance measurement value is: ; This embodiment can further determine the uncertainty of the distance measurement value for downstream processing. This embodiment can fuse the uncertainties of each distance prediction value to obtain the fused uncertainty of the distance measurement value, expressed as: ; in, The distance after fusion (i.e., fusion uncertainty, unit: meters). This represents the variance of the merged distance (unit: meters²). For the first The weight of each submodule, The number of valid submodules, To prevent the variance from being too small and causing the weights to become infinitely large, a stability constant (unit: m², for example) is required. ).

[0061] The main uses of fusion uncertainty are as follows: 1. As the confidence level output of the final ranging result. When the variance of the fused distance is small, it indicates that the outputs of multiple sub-modules are relatively stable and reliable, and the reliability of the fused distance is high; when the variance of the fused distance is large, it indicates that the uncertainty of the current ranging result is high.

[0062] 2. For use by downstream autonomous driving modules. For example, decision-making, planning, or control modules can determine whether to adopt the distance result based on the fused distance variance, or adopt a more conservative control strategy when there is greater uncertainty.

[0063] 3. Used for anomaly detection and degradation strategies. If the variance of the fused distance is large for several consecutive frames, or exceeds a preset threshold, the reliability of the current ranging result can be considered insufficient, thereby triggering degradation processing such as re-fusion, using a single reliable module, extrapolating historical frames, or outputting an unusable flag.

[0064] 4. Used for time series filtering or tracking. When fusing historical frame information later, the fused distance variance can be used as measurement noise input, for example, for Kalman filtering, allowing the system to adaptively adjust the filtering weights based on the uncertainty of the current ranging result.

[0065] Subsequently, after obtaining the distance measurement value and its corresponding fusion uncertainty, the distance measurement value and its corresponding fusion uncertainty can be output for downstream modules (such as autonomous driving modules) to process.

[0066] As can be seen, through this weighted fusion, sub-modules with smaller variance (lower uncertainty) contribute more to the fusion result, while sub-modules with larger variance contribute less, achieving adaptive fusion with advantages. This fusion method comprehensively utilizes the complementary advantages of different distance measurement algorithms, resulting in higher stability and reliability of the final distance measurement value.

[0067] For easier understanding, please refer to Figure 2 , Figure 2 The flowchart of another distance measurement method provided in the embodiment of the present invention illustrates the basic process of distance measurement.

[0068] Based on the above embodiments, the present invention first uses at least two distance measurement algorithms to determine the predicted distance value and uncertainty of the target object in the image under test. The uncertainty is set according to the prediction confidence level determined by the distance measurement algorithm, or according to at least two predicted distance values ​​determined by the distance measurement algorithm, and can characterize the reliability of the predicted distance value. Subsequently, the present invention can determine the fusion weight corresponding to each predicted distance value based on the uncertainty, and can fuse the predicted distance values ​​according to each fusion weight. This allows for the use of different methods to determine the predicted distance value, avoiding the limitation of distance measurement by a single ranging method. Furthermore, fusing predicted distance values ​​determined by multiple methods according to the uncertainty can increase the contribution of more accurate predicted distance values ​​and reduce the contribution of less accurate predicted distance values. Therefore, it can combine the advantages of different ranging algorithms for distance measurement, improving the stability and reliability of distance measurement.

[0069] Based on the above embodiments, considering that unreliable distance prediction values ​​will seriously affect the distance measurement effect, and that the distance measurement effect is also easily affected when there are few reliable distance prediction values, this embodiment can also filter out unreliable abnormal distance prediction values ​​and determine whether the remaining distance prediction values ​​meet the preset number requirements for fusion. If they meet the requirements, the distance prediction values ​​are corrected; if they do not meet the requirements, a downgrade process is performed to further enhance the redundancy and robustness of individual visual ranging.

[0070] For easier understanding, please refer to Figure 3 , Figure 3 A flowchart illustrating a correction and degradation process provided in an embodiment of the present invention. In one embodiment, the method may further include: S41. Determine the deviation between the distance prediction values, determine the abnormal distance prediction values ​​based on the deviation values, and remove the abnormal distance prediction values.

[0071] In this embodiment, the deviation value can be the difference between different distance prediction values, or the difference between a distance prediction value and a distance measurement value. By comparing pairwise and with the distance measurement value, this embodiment can filter out abnormal distance prediction values ​​that deviate significantly from other distance prediction values ​​and remove these abnormal distance prediction values. This reduces the contamination of the fusion result by erroneous output and improves the reliability of the fusion.

[0072] The following describes a method for detecting and filtering out abnormal distance measurements. In one embodiment, determining the deviation between predicted distance values ​​and determining abnormal distance prediction values ​​based on the deviation value may include: S411. Determine the first deviation value between the predicted distance values.

[0073] The first deviation value refers to the difference between any two predicted distance values.

[0074] S412. If the first deviation value between the distance prediction value and the preset number of other distance prediction values ​​is greater than the first preset threshold, then the distance prediction value is marked as the first abnormal distance prediction value.

[0075] In this embodiment, for a given distance prediction value, if the first deviation value between it and a preset number of other distance prediction values ​​is greater than a first preset threshold, then the distance prediction value can be determined to be an outlier that is inconsistent with other distance prediction values, and it can be marked as a first abnormal distance prediction value. The preset number can be set as needed, for example, it can be half of the total number of distance prediction values; the first preset threshold can be set as needed, for example, it can be 3 to 5 meters.

[0076] The first deviation value can be calculated using the following formula: ; in, , Let represent the distance prediction values ​​of the i-th submodule and the j-th submodule, respectively. This represents the first deviation value between the two. If Then mark The two are inconsistent, among which The pairwise consistency threshold is set (ranging from 3 to 5 meters). The number of times each submodule participates in inconsistent pairs is counted. ,like If a module is inconsistent with more than half of the other modules, then that module is marked as a candidate for pairwise anomalies.

[0077] S413. Determine the second deviation between the distance prediction and the distance measurement, and determine the normalized residual value based on the second deviation and the uncertainty of the distance prediction.

[0078] In this embodiment, a statistical significance test can also be performed on the distance prediction values. The second deviation value refers to the absolute difference between a single distance prediction value and the current distance measurement value, which can be expressed as: ; if Then mark the first Several submodules are abnormal, among which The threshold for group consistency (range 2-3 meters).

[0079] The statistical significance test considers the variance of each submodule and uses normalized residuals for the test. The normalized residuals of the i-th submodule are... It can be represented as: ; in, For the first The standard deviation (in meters) of the distance from the output of each submodule. . To prevent the stability constant (meter, for example) from being divided by zero ).

[0080] S414. If the normalized residual value is greater than the second preset threshold, the distance prediction value is marked as the second abnormal distance prediction value.

[0081] In this embodiment, if (Usually 2-3), then mark the first... The distance prediction value of each submodule is identified as the second anomaly distance prediction value, where This is the threshold for statistical anomaly detection (dimensionless, usually taken as 2-3).

[0082] It is evident that statistical significance testing can further improve the accuracy of anomaly detection, identifying distance predictions that, while not conflicting with most algorithms, significantly deviate from the fusion results, thus filling the blind spots of pairwise testing.

[0083] Accordingly, removing abnormal distance predictions can include: S415. Remove the first abnormal distance prediction value and determine whether the remaining distance prediction values ​​contain the second abnormal distance prediction value.

[0084] In this embodiment, during the anomaly removal process, the first anomaly distance prediction value can be removed first because it deviates more severely and is an outlier value that is inconsistent with most algorithms, thus causing greater damage to the fusion result.

[0085] S416. If included, remove the second outlier distance prediction value with the largest normalized residual value.

[0086] After removing the first outlier distance prediction value, if a second outlier distance prediction value still exists among the remaining distance prediction values, the second outlier distance prediction values ​​are sorted in descending order of statistical significance test values, and the second outlier distance prediction value with the largest normalized residual value is removed to further screen out outliers.

[0087] S42. Determine whether the number of remaining distance prediction values ​​meets the preset quantity requirement. If it does, proceed to step S43; otherwise, proceed to step S44.

[0088] In this embodiment, the preset quantity requirement refers to the minimum number of distance prediction values ​​required to ensure the reliability of the fusion result, which can be set to half of the total number of distance measurement algorithms. If the remaining quantity is sufficient, it indicates that the fusion conditions can still be met, and the distance measurement values ​​can be corrected based on the remaining distance prediction values. If the remaining quantity is insufficient, it indicates that most algorithms have failed, the fusion conditions are not met, and a degradation strategy needs to be initiated to maintain the system output.

[0089] S43. Determine the fusion weights based on the uncertainty of the remaining distance predictions, and fuse the remaining distance predictions according to each fusion weight to obtain the distance measurement values.

[0090] In this implementation, after removing abnormal distance predictions, if the number of remaining distance predictions still meets the requirements, the fusion weights can be recalculated based on the uncertainty of each remaining distance prediction, and weighted fusion can be performed. This refusion process can eliminate identified abnormal data, making the final distance measurement value closer to the true distance, improving ranging stability, and reducing the impact of a single failed algorithm on the system.

[0091] During re-fusion, only the sub-modules that were not removed are used for weighted fusion. The corrected distance measurement can be expressed as: ; in, It is a collection of valid sub-modules, containing the remaining distance predictions that were not filtered out.

[0092] The variance after re-integration can also be calculated using the minimum variance criterion, and can be expressed as: .

[0093] S44. If not satisfied, determine the distance measurement value based on the valid distance prediction value in the remaining distance prediction value, or determine the distance measurement value based on the historical distance prediction value, or perform exception handling.

[0094] In this embodiment, if the number of remaining distance predictions is insufficient after removing abnormal distance predictions, a degradation process needs to be performed. This embodiment can provide three degradation methods: 1. Determine the distance measurement value based on the effective distance prediction value in the remaining distance prediction value.

[0095] Effective distance predictions refer to distance predictions that are not marked as anomalies and have a high degree of reliability. The method for setting effective distance predictions can be selected as needed; for example, the distance prediction with the lowest uncertainty can be used as the effective distance prediction. This ensures that the most reliable single ranging result is still provided even in mildly anomalous scenarios, maintaining output continuity and avoiding direct failure due to insufficient fusion conditions.

[0096] Based on this, distance measurements are determined from the effective distance predictions within the remaining distance predictions, including: S4411. Take the distance prediction value with the minimum uncertainty among the remaining distance prediction values ​​as the effective distance prediction value, and take the effective distance prediction value as the distance measurement value.

[0097] At this point, the distance measurement value can be expressed as: ; 2. Determine the distance measurement value based on historical distance prediction values.

[0098] Historical distance prediction values ​​refer to distance measurements or predicted distance values ​​obtained from previous frames of the image to be measured. Since distance changes are continuous across multiple frames, this embodiment can predict the distance measurement value in the current frame based on historical distance prediction values.

[0099] Based on this, determining distance measurements based on historical distance predictions can include: S4421. Obtain historical distance prediction values ​​and the distance change rate determined based on the historical distance prediction values.

[0100] Historical distance prediction refers to the distance measurement or predicted value obtained from the previous frame of the image to be measured. Distance change rate refers to the estimated amount of distance change of the target object per unit time, which can be estimated through distance difference or filtering tracking algorithms between historical frames, and can reflect the movement trend of the target object.

[0101] S4422. Determine the distance measurement value based on the historical distance prediction value, the distance change rate, and the inter-frame time interval.

[0102] In this embodiment, the inter-frame time interval refers to the acquisition time interval between two image frames. This embodiment utilizes kinematic extrapolation to add the historical distance prediction value to the product of the distance change rate and the inter-frame time interval, obtaining the distance measurement value for the current frame. This degradation strategy maintains the output by leveraging the temporal continuity of the target motion when most algorithms fail, providing transitional ranging results to downstream systems, avoiding control interruptions due to momentary failures, and enhancing the system's fault tolerance.

[0103] At this point, the distance measurement value can be expressed as: ; in, This is the fusion distance from the previous frame. The distance change rate estimated in the previous frame. This is the inter-frame time interval.

[0104] 3. Perform exception handling.

[0105] Anomaly handling refers to the process of outputting warning signals or marking the ranging results as unusable when the ranging reliability is insufficient, so that downstream systems can adopt conservative strategies.

[0106] Furthermore, the three degradation methods mentioned above can also be executed according to the degradation level. The degradation level refers to a status indicator representing the current reliability of the system's ranging; the higher the degradation level, the less reliable the system. In this way, the degradation strategy can be flexibly adjusted according to the system's unreliability, improving degradation flexibility.

[0107] Based on this, the distance measurement value is determined based on the valid distance prediction value from the remaining distance prediction values, or based on the historical distance prediction values, or exception handling is performed, including: S4431. Set the degradation level of the current image to be tested according to the target information; wherein, the target information is any one or more of the following: the number of remaining distance prediction values, the fusion uncertainty of distance measurement values, the degradation level of historical images to be tested, and the fusion uncertainty of distance measurement values ​​in historical images to be tested, and the fusion uncertainty is determined according to the uncertainty of distance prediction values.

[0108] The degradation level refers to the status indicator that represents the current reliability of the system's ranging, and can include mild degradation, moderate degradation, and severe degradation.

[0109] The degradation level can be set based on various target information, such as the number of remaining distance predictions, the fusion uncertainty of distance measurements, the degradation level of historical images to be measured, and the fusion uncertainty of distance measurements in historical images to be measured. For example, if the number of remaining distance predictions is one, it is set to mild degradation; if the remaining number is zero or the consistency check fails completely, it is set to moderate degradation; if the historical images to be measured have been in moderate degradation for multiple consecutive frames, it is set to severe degradation. This mutual exclusion switching mechanism ensures that the system enters the corresponding state under different failure levels, avoiding chaotic degradation states. In addition, if the variance of the fused distance is large for multiple consecutive frames, or exceeds a preset threshold, the reliability of the current ranging result can be considered insufficient, thereby triggering degradation processing such as re-fusion, using a single reliable module, extrapolating historical frames, or outputting an unusable flag.

[0110] S4432. Depending on the downgrade level, determine the distance measurement value based on the effective distance prediction value among the remaining distance prediction values, or determine the distance measurement value based on the historical distance prediction values, or perform exception handling.

[0111] In this embodiment, for mild degradation, the result with the least uncertainty among the effective distance prediction values ​​can be selected as the distance measurement value; for moderate degradation, historical distance prediction values ​​are used for motion extrapolation; for severe degradation, a warning signal is output to mark the ranging result as unavailable. Each level is executed from top to bottom according to priority and is mutually exclusive to avoid output jitter caused by state jumps, ensuring the smoothness and predictability of the degradation process.

[0112] Based on the above embodiments, the overall structure of the distance measurement system provided in this embodiment will be described below. Please refer to... Figure 4 , Figure 4 This is a schematic diagram of a distance measurement system provided in an embodiment of the present invention.

[0113] The distance measurement system provided in this invention can be implemented using a modular architecture, comprising four core parts: a distance measurement submodule group, an uncertainty estimation module, a fusion decision module, and an anomaly handling module. The distance measurement submodule group contains parallel processing units composed of at least two distance measurement algorithms employing different technical principles. Each algorithm estimates the distance to the target object in the image under test and outputs a predicted distance value. The uncertainty estimation module is a processing unit used to quantify the reliability of each distance prediction value, outputting uncertainty to characterize the reliability of the corresponding distance prediction value. The fusion decision module receives the distance prediction value and uncertainty, and determines the fusion weight based on the uncertainty for weighted fusion. It also includes a consistency check function to identify abnormal outputs that deviate from the majority of algorithms. The anomaly handling module is a processing unit that initiates a degradation strategy when the distance measurement reliability is insufficient, maintaining the continuity of the system's output in partial failure scenarios.

[0114] The image to be measured acquired by the image acquisition device is synchronously input to the various distance measurement algorithms in the ranging submodule group. After parallel processing, each algorithm outputs a distance prediction value, which is then sent to the uncertainty estimation module for uncertainty quantification. The distance prediction value and uncertainty are then fed into the fusion decision module for optimal weighted fusion to obtain the distance measurement value. After the fusion result undergoes a consistency check, if it is deemed normal, the distance measurement value and the fused uncertainty are directly output. If it is deemed abnormal, the exception handling module is triggered to execute a degradation strategy, ultimately outputting the distance measurement value, a status flag, and the fused uncertainty. The status flag indicates whether the current ranging result is in a degradation state and the degree of degradation. The fused uncertainty refers to the comprehensive reliability quantification value obtained after weighted fusion, which can be used by downstream modules to judge the reliability of the distance measurement value.

[0115] The distance measuring device, electronic device, computer-readable storage medium, and computer program product provided in the embodiments of the present invention will be described below. The distance measuring device, electronic device, computer-readable storage medium, and computer program product described below can be referred to in correspondence with the distance measuring method described above.

[0116] Please refer to Figure 5 , Figure 5 This is a structural block diagram of a distance measuring device provided in an embodiment of the present invention. The device may include: The acquisition module 501 is used to acquire the distance prediction value and uncertainty determined by at least two distance measurement algorithms for a target object in the image under test; wherein, the uncertainty is set according to the prediction confidence determined by the distance measurement algorithm, or according to the at least two distance prediction values ​​determined by the distance measurement algorithm. The weight setting module 502 is used to determine the fusion weights corresponding to each distance prediction value based on the uncertainty. The distance fusion module 503 is used to fuse the predicted distance values ​​according to the fusion weights to obtain the distance measurement value.

[0117] Optionally, module 501 includes: The first submodule is used to obtain the height prediction value and height variance value determined by the distance measurement algorithm for the target object detection box; determine the distance prediction value based on the height prediction value and the preset camera parameter value; and determine the uncertainty based on the height prediction value, height variance value and the preset camera parameter value.

[0118] Optionally, module 501 includes: The second submodule is used to obtain the depth prediction value, scale factor prediction value, and scale factor uncertainty of the area where the target object is located by the distance measurement algorithm; determine the distance prediction value based on the depth prediction value and the scale factor prediction value; determine the depth variance value based on the depth prediction value; and determine the uncertainty based on the depth variance value, the scale factor prediction value, and the scale factor uncertainty.

[0119] Optionally, module 501 includes: The third submodule is used to obtain the predicted coordinates and prediction confidence of the grounding point of the target object determined by the distance measurement algorithm; determine the predicted distance value based on the predicted coordinates and preset camera parameters; and determine the uncertainty based on the prediction confidence and preset basic variance.

[0120] Optionally, the device may further include: The abnormal distance prediction value filtering module is used to determine the deviation value between distance prediction values, determine the abnormal distance prediction value based on the deviation value, and remove the abnormal distance prediction value. The downgrade determination module is used to determine whether the number of remaining distance prediction values ​​meets the preset quantity requirements. The correction module is used to determine the fusion weights based on the uncertainty of the remaining distance predictions if the conditions are met, and to fuse the remaining distance predictions according to the fusion weights to obtain the distance measurement values. The degradation module is used to determine the distance measurement value based on the valid distance prediction value among the remaining distance prediction values, or based on the historical distance prediction value, or to perform exception handling if the conditions are not met.

[0121] Optionally, the anomaly distance prediction filtering module includes: The first marking submodule is used to determine the first deviation value between the distance prediction values; if the first deviation value between the distance prediction value and a preset number of other distance prediction values ​​is greater than the first preset threshold, then the distance prediction value is marked as the first abnormal distance prediction value. The second marking submodule is used to determine the second deviation value between the distance prediction value and the distance measurement value, and to determine the normalized residual value based on the second deviation value and the uncertainty of the distance prediction value; if the normalized residual value is greater than the second preset threshold, the distance prediction value is marked as the second abnormal distance prediction value. The removal submodule is used to remove the first abnormal distance prediction value and determine whether the remaining distance prediction values ​​contain the second abnormal distance prediction value; if they do, the second abnormal distance prediction value with the largest normalized residual value is removed.

[0122] Optionally, the degradation module includes: The first downgrade submodule is used to take the distance prediction value with the minimum uncertainty among the remaining distance prediction values ​​as the effective distance prediction value, and the effective distance prediction value as the distance measurement value.

[0123] Optionally, the degradation module includes: The second degradation submodule is used to obtain historical distance prediction values ​​and distance change rates determined based on historical distance prediction values; and to determine distance measurement values ​​based on historical distance prediction values, distance change rates, and inter-frame time intervals.

[0124] Optionally, the degradation module includes: The downgrade level determination submodule is used to set the downgrade level of the current image to be tested based on the target information. The target information is any one or more of the following: the number of remaining distance prediction values, the fusion uncertainty of distance measurement values, the downgrade level of historical images to be tested, and the fusion uncertainty of distance measurement values ​​in historical images to be tested. The fusion uncertainty is determined based on the uncertainty of the distance prediction values. The downgrade strategy adjustment submodule is used to determine the distance measurement value based on the effective distance prediction value among the remaining distance prediction values, or to determine the distance measurement value based on the historical distance prediction value, or to perform exception handling, depending on the downgrade level.

[0125] Please refer to Figure 6 , Figure 6This is a structural block diagram of an electronic device provided in an embodiment of the present invention. The present invention provides an electronic device 10, including a processor 11 and a memory 12; wherein, the memory 12 is used to store a computer program; the processor 11 is used to execute the distance measurement method provided in the foregoing embodiment when executing the computer program.

[0126] For details regarding the specific process of the above distance measurement method, please refer to the corresponding content provided in the foregoing embodiments, which will not be repeated here.

[0127] Furthermore, the memory 12, as a carrier for resource storage, can be a read-only memory, random access memory, disk, or optical disk, and the storage method can be temporary storage or permanent storage.

[0128] In addition, the electronic device 10 also includes a power supply 13, a communication interface 14, an input / output interface 15, and a communication bus 16; wherein, the power supply 13 is used to provide operating voltage for each hardware device on the electronic device 10; the communication interface 14 can create a data transmission channel between the electronic device 10 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this invention, and is not specifically limited here; the input / output interface 15 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0129] This invention also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the distance measurement method described in the above embodiments.

[0130] Since the embodiments of the computer program product section correspond to the embodiments of the distance measurement method section, please refer to the description of the embodiments of the distance measurement method section for the embodiments of the computer program product section, and will not be repeated here.

[0131] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the distance measurement method described in the above embodiments.

[0132] Since the embodiments of the computer-readable storage medium portion correspond to the embodiments of the distance measurement method portion, the embodiments of the storage medium portion are described in the description of the embodiments of the distance measurement method portion, and will not be repeated here.

[0133] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0134] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0135] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0136] The distance measurement method and electronic device provided by this invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. It should be noted that those skilled in the art can make several improvements and modifications to this invention without departing from the principles of this invention, and these improvements and modifications also fall within the protection scope of this invention.

Claims

1. A distance measurement method, characterized in that, include: Obtain distance prediction values ​​and uncertainties for target objects in the image under test determined by at least two distance measurement algorithms; wherein the uncertainty is set according to the prediction confidence determined by the distance measurement algorithm, or according to at least two distance prediction values ​​determined by the distance measurement algorithm; The fusion weights corresponding to each of the distance prediction values ​​are determined based on the uncertainty. The distance prediction values ​​are fused according to the fusion weights to obtain the distance measurement values.

2. The distance measurement method according to claim 1, characterized in that, The distance measurement algorithm obtains the distance prediction value and uncertainty of the target object in the image under test, including: Obtain the predicted height and height variance of the target object detection box determined by the distance measurement algorithm; The distance prediction value is determined based on the height prediction value and the preset camera parameter value; The uncertainty is determined based on the predicted height value, the height variance value, and the preset camera parameter value.

3. The distance measurement method according to claim 1, characterized in that, The distance measurement algorithm obtains the distance prediction value and uncertainty of the target object in the image under test, including: Obtain the depth prediction, scale factor prediction, and scale factor uncertainty of the area where the target object is located by the distance measurement algorithm; The distance prediction value is determined based on the depth prediction value and the scale factor prediction value; The depth variance is determined based on the depth prediction value, and the uncertainty is determined based on the depth variance value, the scale factor prediction value, and the scale factor uncertainty.

4. The distance measurement method according to claim 1, characterized in that, The distance measurement algorithm obtains the distance prediction value and uncertainty of the target object in the image under test, including: Obtain the predicted coordinates and prediction confidence level of the grounding point of the target object determined by the distance measurement algorithm; The distance prediction value is determined based on the predicted coordinates and preset camera parameters; The uncertainty is determined based on the predicted confidence level and the preset basic variance.

5. The distance measurement method according to any one of claims 1 to 4, characterized in that, Also includes: Determine the deviation value between the distance prediction values, determine the abnormal distance prediction value based on the deviation value, and remove the abnormal distance prediction value; Determine whether the number of remaining distance prediction values ​​meets the preset quantity requirement; If satisfied, the fusion weight is determined based on the uncertainty of the remaining distance prediction value, and the remaining distance prediction values ​​are fused according to each of the fusion weights to obtain the distance measurement value; If the conditions are not met, the distance measurement value is determined based on the valid distance prediction value among the remaining distance prediction values, or based on the historical distance prediction value, or exception handling is performed.

6. The distance measurement method according to claim 5, characterized in that, Determining the deviation between the predicted distance values ​​and determining the abnormal distance prediction value based on the deviation value includes: Determine the first deviation value between the predicted distance values; If the first deviation between the predicted distance value and a preset number of other predicted distance values ​​is greater than a first preset threshold, then the predicted distance value is marked as a first abnormal predicted distance value. A second deviation value is determined between the predicted distance value and the measured distance value, and a normalized residual value is determined based on the second deviation value and the uncertainty of the predicted distance value; If the normalized residual value is greater than the second preset threshold, the distance prediction value is marked as the second abnormal distance prediction value. The removal of the abnormal distance prediction value includes: Remove the first abnormal distance prediction value and determine whether the remaining distance prediction values ​​contain the second abnormal distance prediction value; If included, remove the second outlier distance prediction with the largest normalized residual value.

7. The distance measurement method according to claim 5, characterized in that, Determining the distance measurement value based on the effective distance prediction value from the remaining distance prediction values ​​includes: The distance prediction value with the lowest uncertainty among the remaining distance prediction values ​​is taken as the effective distance prediction value, and the effective distance prediction value is taken as the distance measurement value.

8. The distance measurement method according to claim 5, characterized in that, Determining the distance measurement value based on historical distance prediction values ​​includes: Obtain historical distance prediction values ​​and distance change rates determined based on the historical distance prediction values; The distance measurement value is determined based on the historical distance prediction value, the distance change rate, and the inter-frame time interval.

9. The distance measurement method according to claim 5, characterized in that, The distance measurement value is determined based on the valid distance prediction values ​​from the remaining distance prediction values, or based on historical distance prediction values, or exception handling is performed, including: The degradation level of the current image to be tested is set according to the target information; wherein, the target information is any one or more of the following: the number of remaining distance prediction values, the fusion uncertainty of the distance measurement values, the degradation level of historical images to be tested, and the fusion uncertainty of distance measurement values ​​in historical images to be tested, and the fusion uncertainty is determined based on the uncertainty of the distance prediction values; Depending on the downgrade level, the distance measurement value may be determined based on the effective distance prediction value among the remaining distance prediction values, or based on the historical distance prediction values, or exception handling may be performed.

10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the distance measurement method as described in any one of claims 1 to 9 when executing the computer program.