Method and Apparatus for Detecting Complexity of Traveling Scenario of Vehicle
20230050063 · 2023-02-16
Inventors
Cpc classification
G06V20/58
PHYSICS
B60W60/0059
PERFORMING OPERATIONS; TRANSPORTING
G06V20/588
PHYSICS
B60W2554/408
PERFORMING OPERATIONS; TRANSPORTING
B60W2552/05
PERFORMING OPERATIONS; TRANSPORTING
B60W30/16
PERFORMING OPERATIONS; TRANSPORTING
B60W2555/20
PERFORMING OPERATIONS; TRANSPORTING
B60W2554/804
PERFORMING OPERATIONS; TRANSPORTING
International classification
B60W30/16
PERFORMING OPERATIONS; TRANSPORTING
Abstract
This application discloses a method and an apparatus for detecting a complexity of a traveling scenario of a vehicle, comprising: obtaining a travelling speed of the vehicle and a travelling speed of a target vehicle; determining, based on the traveling speed of the vehicle and the traveling speed of the target vehicle, a dynamic complexity of a traveling scenario in which the vehicle is located; determining static information of each static factor in the traveling scenario in which the vehicle is currently located; obtaining, based on the static information of each static factor, a static complexity of the traveling scenario in which the vehicle is located; and obtaining, based on the dynamic complexity and the static complexity, a comprehensive complexity of the traveling scenario in which the vehicle is located.
Claims
1. A method for detecting a complexity of a traveling scenario of a vehicle, wherein the method comprises: obtaining a traveling speed of the vehicle and a traveling speed of a target vehicle, wherein the target vehicle is a vehicle that meets a preset distance condition with the vehicle; obtaining, based on the traveling speed of the vehicle and the traveling speed of the target vehicle, a dynamic complexity of a traveling scenario in which the vehicle is located; obtaining static information of each static factor in the traveling scenario in which the vehicle is located; obtaining, based on the static information of each static factor, a static complexity of the traveling scenario in which the vehicle is located; and obtaining, based on the dynamic complexity and the static complexity, a comprehensive complexity of the traveling scenario in which the vehicle is located.
2. The method according to claim 1, wherein the obtaining, based on the traveling speed of the vehicle and the traveling speed of the target vehicle, a dynamic complexity of a traveling scenario in which the vehicle is located comprises: obtaining, for each target vehicle based on the traveling speed of the vehicle and a traveling speed of the target vehicle, a complexity corresponding to the target vehicle; and adding the complexities corresponding to the target vehicles to obtain the dynamic complexity of the traveling scenario in which the vehicle is located.
3. The method according to claim 2, wherein the determining, based on the traveling speed of the vehicle and a traveling speed of the target vehicle, a complexity corresponding to the target vehicle comprises: obtaining a relative traveling speed between the vehicle and the target vehicle based on the traveling speed of the vehicle and the traveling speed of the target vehicle; obtaining an included angle θ.sub.ij between a traveling direction of the vehicle and the relative traveling speed between the vehicle and the target vehicle; and obtaining, based on the included angle θ.sub.ij, the complexity corresponding to the target vehicle.
4. The method according to claim 1, wherein the static factor comprises a plurality of static factors, and the obtaining, based on the static information of each static factor, a static complexity of the traveling scenario in which the vehicle is located comprises: obtaining values of the plurality of static factors based on static information of the plurality of static factors, and obtaining, based on a correspondence between the values of the plurality of static factors and complexities, complexities respectively corresponding to the plurality of static factors; and obtaining, based on the complexities respectively corresponding to the plurality of static factors, the static complexity of the traveling scenario in which the vehicle is located.
5. The method according to claim 4, wherein the determining, based on the complexities respectively corresponding to the plurality of static factors, the static complexity of the traveling scenario in which the vehicle is located comprises: obtaining weights respectively corresponding to the plurality of static factors; respectively multiplying the complexities corresponding to the values of the plurality of static factors by the corresponding weights to obtain weighted complexities respectively corresponding to the plurality of static factors; and adding the weighted complexities corresponding to the plurality of static factors to obtain the static complexity of the traveling scenario in which the vehicle is located.
6. The method according to claim 5, wherein the method further comprises: for a first value of a first static factor, obtaining N sample images corresponding to the first value, wherein N is an integer greater than 1; separately performing image recognition on the N sample images to obtain a predicted value corresponding to each sample image; counting a quantity M of sample images whose corresponding predicted values are different from corresponding ground truth values, wherein the ground truth value is used to uniquely identify the first value; and obtaining a ratio of M to N as a complexity corresponding to the first value.
7. The method according to claim 1, wherein the static factor comprises at least one of a road type, a quantity of co-directional lanes, a lane width, a central isolation form, an isolation form between a motor vehicle and a non-motor vehicle, a traffic sign, and a traffic light.
8. The method according to claim 1, wherein the method further comprises: obtaining environment information of an environment factor in the traveling scenario in which the vehicle is located; obtaining a value of the environment factor based on the environment information of the environment factor; and obtaining, based on a stored correspondence between a value of an environment factor and a complexity correction coefficient, a target complexity correction coefficient corresponding to the environment factor in the traveling scenario in which the vehicle is located; and the obtaining, based on the dynamic complexity and the static complexity, a comprehensive complexity of the traveling scenario in which the vehicle is located comprises: multiplying, by the target complexity correction coefficient, a value obtained by adding the dynamic complexity and the static complexity, to obtain the comprehensive complexity of the traveling scenario in which the vehicle is located.
9. The method according to claim 8, wherein the environment factor comprises at least one of lighting, weather, and a road surface condition.
10. The method according to claim 1, wherein the determining a target vehicle that meets a preset distance condition with the vehicle comprises: if there is a forward vehicle in a same lane as the vehicle, determining, as a reference vehicle, a forward vehicle that is in the forward vehicle in the same lane as the vehicle and that has a minimum distance from the vehicle; obtaining a traveling speed of the reference vehicle and a component of a distance between the reference vehicle and the vehicle in the traveling direction of the vehicle; obtaining a second safe distance between the vehicle and the reference vehicle based on the traveling speed, a preset maximum acceleration, and a preset minimum deceleration of the vehicle, the traveling speed and a preset maximum deceleration of the reference vehicle, and the preset driver reaction time; obtaining a smaller value in the second safe distance and the component of the distance between the reference vehicle and the vehicle in the traveling direction of the vehicle; and using, as the target vehicle, a forward vehicle in a lane in which the vehicle is located and an adjacent lane, wherein a component of a distance between the forward vehicle and the vehicle in the traveling direction of the vehicle is not greater than the smaller value; or if there is no forward vehicle in a same lane as the vehicle, obtaining a third safe distance based on the traveling speed, a preset maximum acceleration, and a preset minimum deceleration of the vehicle, a preset forward-vehicle traveling speed, the preset maximum deceleration, and the preset driver reaction time, wherein the preset forward-vehicle traveling speed is 0; and using, as the target vehicle, a forward vehicle in a lane in which the vehicle is located and an adjacent lane, wherein a component of a distance between the forward vehicle and the vehicle in the traveling direction of the vehicle is not greater than the third safe distance.
11. An apparatus for determining a complexity of a traveling scenario of a vehicle, wherein the apparatus comprises: at least one processor; and a memory coupled to the at least one processor and storing programming instructions for execution by the at least one processor, the programming instructions for execution by the at least one processor, the programming instructions instruct the at least one processor to perform the following operations: obtaining a traveling speed of the vehicle and a traveling speed of a target vehicle, wherein the target vehicle is a vehicle that meets a preset distance condition with the vehicle; obtaining, based on the traveling speed of the vehicle and the traveling speed of the target vehicle, a dynamic complexity of a traveling scenario in which the vehicle is located; obtaining static information of each static factor in the traveling scenario in which the vehicle is located; obtaining, based on the static information of each static factor, a static complexity of the traveling scenario in which the vehicle is located; and obtaining, based on the dynamic complexity and the static complexity, a comprehensive complexity of the traveling scenario in which the vehicle is located.
12. The apparatus according to claim 11, wherein the programming instructions instruct the at least one processor to perform the following operation: obtaining, for each target vehicle based on the traveling speed of the vehicle and a traveling speed of the target vehicle, a complexity corresponding to the target vehicle; and adding the complexities corresponding to the target vehicles to obtain the dynamic complexity of the traveling scenario in which the vehicle is located.
13. The apparatus according to claim 11, wherein the programming instructions instruct the at least one processor to perform the following operation: obtaining values of the plurality of static factors based on static information of the plurality of static factors, and obtain, based on a correspondence between the values of the plurality of static factors and complexities, complexities respectively corresponding to the plurality of static factors; and obtaining, based on the complexities respectively corresponding to the plurality of static factors, the static complexity of the traveling scenario in which the vehicle is located.
14. The apparatus according to claim 13, wherein the programming instructions instruct the at least one processor to perform the following operation: obtaining weights respectively corresponding to the plurality of static factors; respectively multiplying the complexities corresponding to the values of the plurality of static factors by the corresponding weights to obtain weighted complexities respectively corresponding to the plurality of static factors; and adding the weighted complexities corresponding to the plurality of static factors to obtain the static complexity of the traveling scenario in which the vehicle is located.
15. The apparatus according to claim 13, wherein the programming instructions instruct the at least one processor to perform the following operation: for a first value of a first static factor, obtaining N sample images corresponding to the first value, wherein N is an integer greater than 1; separately perform image recognition on the N sample images to obtain a predicted value corresponding to each sample image; count a quantity M of sample images whose corresponding predicted values are different from corresponding ground truth values, wherein the ground truth value is used to uniquely identify the first value; and obtain a ratio of M to N as a complexity corresponding to the first value.
16. The apparatus according to claim 11, wherein the static factor comprises at least one of a road type, a quantity of co-directional lanes, a lane width, a central isolation form, an isolation form between a motor vehicle and a non-motor vehicle, a traffic sign, and a traffic light.
17. The apparatus according to claim 11, wherein the programming instructions instruct the at least one processor to perform the following operation: obtaining environment information of an environment factor in the traveling scenario in which the vehicle is located; obtaining a value of the environment factor based on the environment information of the environment factor; and obtaining, based on a stored correspondence between a value of an environment factor and a complexity correction coefficient, a target complexity correction coefficient corresponding to the value of the environment factor in the traveling scenario in which the vehicle is located, wherein the fourth module is configured to: multiplying, by the target complexity correction coefficient, a value obtained by adding the dynamic complexity and the static complexity, to obtain the comprehensive complexity of the traveling scenario in which the vehicle is located.
18. The apparatus according to claim 17, wherein the environment factor comprises at least one of lighting, weather, and a road surface condition.
19. The apparatus according to claim 11, wherein the programming instructions instruct the at least one processor to perform the following operation: if there is a forward vehicle in a same lane as the vehicle, determining, as a reference vehicle, a forward vehicle that is in the forward vehicle in the same lane as the vehicle and that has a minimum distance from the vehicle; obtaining a traveling speed of the reference vehicle and a component of a distance between the reference vehicle and the vehicle in the traveling direction of the vehicle; obtaining a second safe distance between the vehicle and the reference vehicle based on the traveling speed, a preset maximum acceleration, and a preset minimum deceleration of the vehicle, the traveling speed and a preset maximum deceleration of the reference vehicle, and the preset driver reaction time; obtaining a smaller value in the second safe distance and the component of the distance between the reference vehicle and the vehicle in the traveling direction of the vehicle; and using, as the target vehicle, a forward vehicle in a lane in which the vehicle is located and an adjacent lane, wherein a component of a distance between the forward vehicle and the vehicle in the traveling direction of the vehicle is not greater than the smaller value; or if there is no forward vehicle in a same lane as the vehicle, obtaining a third safe distance based on the traveling speed, a preset maximum acceleration, and a preset minimum deceleration of the vehicle, a preset forward-vehicle traveling speed, the preset maximum deceleration, and the preset driver reaction time, wherein the preset forward-vehicle traveling speed is 0; and using, as the target vehicle, a forward vehicle in a lane in which the vehicle is located and an adjacent lane, wherein a component of a distance between the forward vehicle and the vehicle in the traveling direction of the vehicle is not greater than the third safe distance.
20. A computer program product comprising computer-executable instructions stored on a non-transitory computer-readable storage medium that, when executed by a processor, cause an apparatus to: obtaining a traveling speed of the vehicle and a traveling speed of a target vehicle, wherein the target vehicle is a vehicle that meets a preset distance condition with the vehicle; obtaining, based on the traveling speed of the vehicle and the traveling speed of the target vehicle, a dynamic complexity of a traveling scenario in which the vehicle is located; obtaining static information of each static factor in the traveling scenario in which the vehicle is located; obtaining, based on the static information of each static factor, a static complexity of the traveling scenario in which the vehicle is located; and obtaining, based on the dynamic complexity and the static complexity, a comprehensive complexity of the traveling scenario in which the vehicle is located.
Description
BRIEF DESCRIPTION OF DRAWINGS
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
DESCRIPTION OF EMBODIMENTS
[0056] To make objectives, technical solutions, and advantages of this application clearer, the following further describes implementations of this application in detail with reference to the accompanying drawings.
[0057] Embodiments of this application provide a method for detecting a complexity of a traveling scenario of a vehicle, and the method may be applied to a self-driving car. The method may be implemented by a vehicle traveling decision controller in the self-driving car. A sensing system, a positioning system, and the like may be deployed in the self-driving car. The sensing system may include a radar, a camera, and the like. The positioning system may be a global positioning system (Global Positioning System, GPS), a BeiDou system, and the like.
[0058]
[0059] The vehicle traveling decision controller collects traveling data of a forward vehicle in a specific range by using a sensing system, obtains, by combining a positioning system and a high-definition map, a value of each static factor in a traveling scenario in which a current vehicle is located, and comprehensively calculates a complexity of the traveling scenario in which the vehicle is located.
[0060] Referring to
[0061] Step 201: Obtain a traveling speed of the vehicle and a traveling speed of a target vehicle, where the target vehicle is a vehicle that meets a preset distance condition with the vehicle.
[0062] In an implementation, the target vehicle that meets the preset distance condition with the vehicle may be first determined as a research vehicle for subsequently calculating a dynamic complexity of a traveling scenario in which the vehicle is located. A method for determining the target vehicle that meets the preset distance condition with the vehicle may be as follows:
[0063] A forward vehicle in the traveling scenario in which the vehicle is located is detected by using a radar, and if there is a forward vehicle in a same lane as the vehicle, a forward vehicle that has a minimum distance from the vehicle is determined as a reference vehicle. Next, a traveling speed of the reference vehicle and a component of a distance between the reference vehicle and the vehicle in a traveling direction of the vehicle are obtained by using the radar. Herein, a component of a distance between a vehicle and the current vehicle in the traveling direction of the current vehicle may also be referred to as a vertical distance between the vehicle and the current vehicle.
[0064] Then, a second safe distance d.sub.min between the reference vehicle and the vehicle is calculated. A calculation formula may be as follows:
[0065] V.sub.following is the traveling speed of the vehicle, V.sub.leading is the traveling speed of the reference vehicle, a.sub.max, accel is a preset maximum acceleration of the vehicle, for example, may be 0.2 g, where g is a gravity acceleration, a.sub.min, brake is a preset minimum deceleration of the vehicle, for example, may be 0.3 g, b.sub.max, brake represents a preset maximum deceleration of the forward vehicle, for example, may be 0.4 g, and ρ is a preset driver reaction time, for example, may be 2s.
[0066] Subsequently, a smaller value in the determined second safe distance and the vertical distance between the reference vehicle and the vehicle may be determined. A forward vehicle in a lane in which the vehicle is located and an adjacent lane is determined as the target vehicle, where a vertical distance between the forward vehicle and the vehicle is not greater than the smaller value.
[0067] If there is no forward vehicle in a same lane as the vehicle, it may be assumed that there is a forward vehicle in a same lane as the vehicle, the forward vehicle is used as a reference vehicle, and a traveling speed of the assumed reference vehicle is 0. A third safe distance between the reference vehicle and the vehicle is calculated. A calculation formula of the third safe distance is the same as the calculation formula of the second safe distance, and details are not described herein again.
[0068] Step 202: Obtain, based on the traveling speed of the vehicle and the traveling speed of the target vehicle, a dynamic complexity of a traveling scenario in which the vehicle is located.
[0069] In an implementation, for each target vehicle, a complexity corresponding to the target vehicle is determined based on the traveling speed of the vehicle and a traveling speed of the target vehicle. The determined complexities corresponding to the target vehicles are added to obtain the dynamic complexity of the traveling scenario in which the vehicle is located. The following describes a method for determining the complexity corresponding to the target vehicle.
[0070] First, an included angle θ.sub.ij between the traveling direction of the vehicle and a relative traveling speed between the vehicle and the target vehicle is calculated. A calculation formula may be as follows:
[0071] {right arrow over (V.sub.h_ij)} is a horizontal relative speed between the vehicle and the target vehicle, namely, a value obtained by subtracting a component of the traveling speed of the vehicle in a horizontal direction perpendicular to the traveling direction of the vehicle from a component of the traveling speed of the target vehicle in the horizontal direction perpendicular to the traveling direction of the vehicle, and {right arrow over (V.sub.v_ij)} is a vertical relative speed between the vehicle and the target vehicle, namely, a value obtained by subtracting a component of the traveling speed of the vehicle in the traveling direction of the vehicle from a component of the traveling speed of the target vehicle in the traveling direction of the vehicle.
[0072] Next, the calculated included angle θ.sub.ij is substituted into the following formula:
[0073] An initial complexity f(θ.sub.ij) corresponding to the target vehicle may be obtained.
[0074] Then, the initial complexity f(θ.sub.ij) corresponding to the target vehicle may be corrected based on a distance between the target vehicle and the vehicle and the relative speed between the target vehicle and the vehicle, to obtain the complexity corresponding to the target vehicle. The correction method may include the following steps:
[0075] 1. Calculate a vertical correction coefficient, where a method for calculating the vertical correction coefficient may be as follows:
[0076] First, a first safe distance between the vehicle and the target vehicle is calculated. A calculation formula of the first safe distance is the same as the calculation formula of the second safe distance, and details are not described herein again. Next, a first difference between a preset danger distance {right arrow over (D.sub.v_max)} and a vertical distance {right arrow over (D.sub.v_ij)} between the target vehicle and the vehicle is calculated. Then, a second difference between a safety critical value {right arrow over (D.sub.v_min)} and the preset danger distance {right arrow over (D.sub.v_max)} is calculated. The safety critical value {right arrow over (D.sub.v_min)} may be the first safe distance between the vehicle and the target vehicle, and {right arrow over (D.sub.v_max)} may be 0 m. Subsequently, a ratio between the first difference and the second difference is calculated to obtain a standard vertical distance p between the vehicle and the target vehicle. The standard vertical distance p may be represented as follows:
P=({right arrow over (D.sub.v_max)}−{right arrow over (D.sub.v_ij)})/({right arrow over (D.sub.v_max)}−{right arrow over (D.sub.v_min)})
[0077] Then, the standard vertical distance p is substituted into the formula f.sub.1(p)=(1−p)1g(1/p), to obtain the vertical correction coefficient f.sub.1(p).
[0078] 2. Calculate a horizontal correction coefficient, where a method for calculating the horizontal correction coefficient may be as follows:
[0079] First, a third difference between a preset danger horizontal relative speed {right arrow over (V.sub.h_max )} and the horizontal relative speed {right arrow over (V.sub.h_ij )} between the target vehicle and the vehicle is calculated. Next, a fourth difference between a preset safe horizontal relative speed {right arrow over (V.sub.h_min)} and the preset danger horizontal relative speed {right arrow over (V.sub.h_max)} is calculated. {right arrow over (V.sub.h_min)} may be 3.5 m/s, and indicates that a speed at which the vehicle and the target vehicle approach each other in a horizontal direction is 3.5 m/s. {right arrow over (V.sub.h_max)} may be −3.5 m/s, and indicates that a speed at which the vehicle and the target vehicle are separated from each other in the horizontal direction is 3.5 m/s. Subsequently, a ratio between the third difference and the fourth difference is calculated to obtain a standard horizontal relative speed q between the vehicle and the target vehicle. The standard horizontal relative speed q may be represented as follows:
q=({right arrow over (V.sub.h_max)}−{right arrow over (V.sub.h_ij)})/({right arrow over (V.sub.h_max)}−{right arrow over (V.sub.h_min)})
[0080] Then, the standard horizontal relative speed q is substituted into the formula f.sub.1(q)=(1−q)1g(1/q), to obtain the horizontal correction coefficient f.sub.1(q).
[0081] 3. Multiply the initial complexity f(θ.sub.ij), the vertical correction coefficient f.sub.1(q), and the horizontal correction coefficient f.sub.1(q), to obtain the complexity corresponding to the target vehicle. It should be noted herein that the sequence of calculating the vertical correction coefficient and the horizontal correction coefficient is merely an example. The sequence of calculating the two correction coefficients is not limited in this embodiment of this application, and the two correction coefficients may be calculated in parallel in a possible implementation.
[0082] Step 203: Obtain static information of each static factor in the traveling scenario in which the vehicle is currently located.
[0083] The static factor includes a road type, a quantity of co-directional lanes, a lane width, a central isolation form, an isolation form between a motor vehicle and a non-motor vehicle, a traffic sign, and a traffic light.
[0084] In an implementation, a positioning system may be used to determine a current location, and a high-definition map may be used to determine the static information of each static factor at the current location (the traveling scenario in which the vehicle is located) of the vehicle. For example, the following is obtained: In the traveling scenario in which the vehicle is currently located, the road type is an urban expressway, the quantity of co-directional lanes is 2, a lane width greater than 3.5 m is a wide lane, the central isolation form is greening isolation, the isolation form between the motor vehicle and the non-motor vehicle is greening isolation, the traffic sign is that there is a speed limit sign, and the traffic light is that there is a traffic light. The following describes possible static information of each static factor.
[0085] Static information of the road type may be an urban expressway, a trunk road, a secondary trunk road, and a branch way. Static information of the quantity of co-directional lanes may be 1, 2, 3, 4, 5, 6, and the like. Static information of the lane width may be 3 m, 3.5 m, 4 m, 4.5 m, and the like. Static information of the central isolation form may be: there is no central isolation, marking-line isolation, a hard barrier, and greening isolation. Static information of the isolation form between the motor vehicle and the non-motor vehicle may be: there is no isolation between the motor vehicle and the non-motor vehicle, marking-line isolation, a hard barrier, and greening isolation. Static information of the traffic sign may be: a speed limit sign of 40 km/h, a speed limit sign of 60 km/h, there is no speed limit sign, and the like. Static information of the traffic light is that the traffic light is a red light, the traffic light is a green light, the traffic light is a yellow light, and there is no traffic light.
[0086] Step 204: Obtain, based on the static information of each static factor, a static complexity of the traveling scenario in which the vehicle is located.
[0087] In an implementation, values of a plurality of static factors in the traveling scenario in which the vehicle is located may be first obtained based on determined static information of the plurality of static factors. Next, complexities respectively corresponding to the values of the plurality of static factors in the traveling scenario in which the vehicle is located are determined based on a correspondence between a value of a static factor and a complexity. Finally, the static complexity of the traveling scenario in which the vehicle is located is obtained based on the complexities respectively corresponding to the plurality of static factors.
[0088] Because the static factor has various static information, if each piece of static information independently corresponds to one value, the correspondence between a value of a static factor and a complexity is relatively complex. Therefore, for some static information, a plurality of pieces of static information may correspond to one value. The following describes a relationship between the static information of the static factor and the value of the static factor.
[0089] The static information of the road type may be directly determined as a value of the road type, that is, values respectively corresponding to the static information: the urban expressway, the trunk road, the secondary trunk road, and the branch way may also be the urban expressway, the trunk road, the secondary trunk road, and the branch way. When the static information of the quantity of co-directional lanes is 1 to 4, the static information of the quantity of co-directional lanes may be directly determined as a value of the quantity of co-directional lanes. When the static information of the quantity of co-directional lanes is 5, 6, 7, and the like, a same value “≥5” may be correspondingly determined. When the static information of the lane width is 3 m and 3.5 m, a same value “≤3.5 m” may be correspondingly determined. When the static information of the lane width is 4 m, 4.5 m, and the like, a same value “>3.5 m” may be correspondingly determined. The static information of the central isolation form may be directly determined as a value of the central isolation form. The static information of the isolation form between the motor vehicle and the non-motor vehicle may be directly determined as a value of the isolation form between the motor vehicle and the non-motor vehicle. When the static information of the traffic sign is a speed limit sign of 40 km/h, a speed limit sign of 60 km/h, and the like, a corresponding value may be “there is a speed limit sign”. When the static information of the traffic sign is that there is no speed limit sign, a corresponding value may be “there is no speed limit sign”. When the static information corresponding to the traffic light is that the traffic light is a red light, the traffic light is a green light, and the traffic light is a yellow light, a same value “there is a traffic light” may be correspondingly determined. When the static information corresponding to the traffic light is that there is no traffic light, a corresponding value may be “there is no traffic light”.
[0090] A value of each static factor may be shown in the following Table 1.
TABLE-US-00001 TABLE 1 Static factor Value Road type Urban expressway, trunk road, secondary trunk road, and branch way Quantity of co- 1, 2, 3, 4, 5, and a value greater than 5 directional lanes Lane width Wide lane (lane width ≥3.5 m) and narrow lane (lane width < 3.5 m) Central isolation There is no central isolation, marking-line form isolation, hard barrier, and greening isolation Isolation form between There is no isolation between the motor vehicle a motor vehicle and and the non-motor vehicle, marking-line isolation, a non-motor vehicle hard barrier, and greening isolation Traffic sign There is a speed limit sign and there is no speed limit sign Traffic light There is a traffic light and there is no traffic light
[0091] The correspondence between a value of a static factor and a complexity may be shown in Table 2.
TABLE-US-00002 TABLE 2 Static factor Value (complexity) Road type Urban expressway (c.sub.1, 1), trunk road (c.sub.1, 2), secondary trunk road (c.sub.1, 3), and branch way (c.sub.1, 4) Quantity of co- 1 (c.sub.2, 1), 2 (c.sub.2, 2), 3 (c.sub.2, 3), 4 (c.sub.2, 4), 5, and directional lanes a value greater than 5 (C.sub.2, 5) Lane width Wide lane (c.sub.3, 1) and narrow lane (c.sub.3, 2) Central isolation There is no central isolation (c.sub.4, 1), marking-line form isolation (c.sub.4, 2), hard barrier (c.sub.4, 3), and greening isolation (c.sub.4, 4) Isolation form There is no isolation between the motor vehicle and between a motor the non-motor vehicle (c.sub.5, 1), marking-line isolation vehicle and a non- (c.sub.5, 2), hard barrier (c.sub.5, 3), and greening isolation motor vehicle (c.sub.5, 4) Traffic sign There is a speed limit sign (c.sub.6, 1) and there is no speed limit sign (c.sub.6, 2) Traffic light There is a traffic light (c.sub.7, 1) and there is no traffic light (c.sub.7, 2)
[0092] For each static factor, a weight corresponding to the static factor may be obtained based on a correspondence between a static factor and a weight, and a complexity corresponding to the static factor is multiplied by the weight corresponding to the static factor, to obtain a weighted complexity of the static factor. The correspondence between a static factor and a weight may be shown in Table 3.
[0093] Finally, the weighted complexities corresponding to the static factors are added to obtain the static complexity of the traveling scenario in which the vehicle is located.
TABLE-US-00003 TABLE 3 Static factor Weight Road type W.sub.1 Quantity of co-directional lanes W.sub.2 Lane width W.sub.3 Central isolation form W.sub.4 Isolation form between a motor W.sub.5 vehicle and a non-motor vehicle Traffic sign W.sub.6 Traffic light W.sub.7
[0094] In a possible implementation, a technical person may pre-determine a complexity corresponding to each value of each static factor. A method for determining the complexity corresponding to each value of each static factor may be as follows:
[0095] For each value of each static factor, N sample images corresponding to the value are obtained. N is an integer greater than 1. The sample image may be obtained in the following manner: The sample image is captured by using a high-definition streetscape map, is photographed in the field, is downloaded by using the Internet, or the like A method for obtaining the sample image is not limited in this embodiment of this application. Then, image recognition is separately performed on the N sample images to obtain a predicted value corresponding to each sample image. A quantity M of sample images whose corresponding predicted values are different from corresponding ground truth values is counted. The ground truth value is used to uniquely identify a value. A ratio of M to N is determined as the complexity corresponding to the value. The following uses determining of a complexity corresponding to greening isolation as an example for description.
[0096] In the high-definition streetscape map, 100 streetscape images with greening isolation are captured as sample images corresponding to greening isolation. Certainly, 100 streetscape images with greening isolation may be photographed in the field as sample images corresponding to greening isolation, or 100 streetscape images with greening isolation may be downloaded, by using the Internet, as sample images corresponding to greening isolation. Then, image recognition may be separately performed on the 100 sample images by using an image recognition algorithm. Herein, the image recognition algorithm may be a trained neural network model or the like. Each value of the central isolation form may correspond to one ground truth value, for example, no central isolation is 0, marking-line isolation is 1, a hard barrier is 2, and greening isolation is 3. After image recognition is performed on each sample image, a predicted value corresponding to the sample image may be obtained. If the predicted value is different from the ground truth value, it is considered that recognition is incorrect, and a quantity of sample images that are incorrectly recognized is recorded. For example, if there are 90 sample images that are incorrectly recognized, the quantity 90 of sample images that are incorrectly recognized is divided by the total quantity 100 of sample images to obtain a recognition error rate 90%. The recognition error rate may be used as the complexity corresponding to greening isolation.
[0097] The weight corresponding to each static factor may be determined and stored by using an analytic hierarchy process. The following describes a process of determining, by using the analytic hierarchy process, the weight corresponding to the static factor.
[0098] First, a technical person may fill in a static factor importance determining matrix table based on a ratio scale table used when static factors are compared. The static factor importance determining matrix table may be shown in Table 4, and the ratio scale table may be shown in the following Table 5.
[0099] Then, a product of elements b.sub.kl in each row of the static factor importance determining matrix table is calculated. A calculation formula may be as follows:
[0100] Subsequently, an n.sup.th root V.sub.k of M.sub.k is calculated. A calculation formula may be as follows:
[0101] Finally, a feature vector W.sub.k of a static factor importance determining matrix, namely, the weight corresponding to the static factor, is calculated. A calculation formula may be as follows:
TABLE-US-00004 TABLE 4 Static factor l Isolation form between a Quantity of Central motor vehicle Road co-directional Lane isolation and a non-motor Traffic Traffic Static factor k type lanes width form vehicle sign light Road type b.sub.11 b.sub.12 b.sub.13 b.sub.14 b.sub.15 b.sub.16 b.sub.17 Quantity of co- b.sub.21 b.sub.22 b.sub.23 b.sub.24 b.sub.25 b.sub.26 b.sub.27 directional lanes Lane width b.sub.31 b.sub.32 b.sub.33 b.sub.34 b.sub.35 b.sub.36 b.sub.37 Central isolation b.sub.41 b.sub.42 b.sub.43 b.sub.44 b.sub.45 b.sub.46 b.sub.47 form Isolation form b.sub.51 b.sub.52 b.sub.53 b.sub.54 b.sub.55 b.sub.56 b.sub.57 between a motor vehicle and a non- motor vehicle Traffic sign b.sub.61 b.sub.62 b.sub.63 b.sub.64 b.sub.65 b.sub.66 b.sub.67 Traffic light b.sub.71 b.sub.72 b.sub.73 b.sub.74 b.sub.75 b.sub.76 b.sub.77
TABLE-US-00005 TABLE 5 Ratio of a factor k to a factor 1 Quantized value Equal importance 1 Slight importance 3 Strong importance 5 Intense importance 7 Extreme importance 9 Intermediate value of two times 2, 4, 6, 8 of adjacent determining
[0102] Step 205: Determine, based on the dynamic complexity and the static complexity, a comprehensive complexity of the traveling scenario in which the vehicle is located.
[0103] In an implementation, the determined dynamic complexity and the determined static complexity may be directly added to obtain the comprehensive complexity of the traveling scenario in which the vehicle is located.
[0104] In a possible implementation, an environment factor of the traveling scenario in which the vehicle is located may be considered to comprehensively determine the comprehensive complexity of the traveling scenario in which the vehicle is located. A determining method may be as follows: obtaining environment information of an environment factor in the traveling scenario in which the vehicle is located; obtaining a value of the environment factor based on the environment information of the environment factor; determining, based on a stored correspondence between a value of an environment factor and a complexity correction coefficient, a target complexity correction coefficient corresponding to the environment factor in the traveling scenario in which the vehicle is located; and multiplying, by the target complexity correction coefficient, a value obtained by adding the dynamic complexity and the static complexity, to obtain the comprehensive complexity of the traveling scenario in which the vehicle is located.
[0105] The environment factor includes lighting, weather, and a road surface condition.
[0106] In an implementation, an environment image in the traveling scenario may be obtained by using a camera of a sensing system of the vehicle, and environment information of each environment factor is recognized from the environment image by using a pattern recognition algorithm constructed in advance. Because an output of the pattern recognition algorithm is several pieces of preset possible environment information, the environment information of the environment factor may be directly determined as the value of the environment factor. A value of each environment factor may be shown in the following Table 6.
TABLE-US-00006 TABLE 6 Environment factor Value Lighting Daytime, dusk or dawn, night with lighting, and night without lighting Weather Sunny day, cloudy day, rainy day, snowy day, and foggy day Environment factor Value Road surface Dryness, wetness, accumulated snow, and ice condition
[0107] The correspondence between a value of each environment factor and a complexity correction coefficient may be shown in the following Table 7. It should be noted that Table 7 merely provides an example of the complexity correction coefficient.
TABLE-US-00007 TABLE 7 Environment factor Value (complexity correction coefficient) Lighting Daytime (1), dusk or dawn (1.2), night with lighting (1.5), and night without lighting (2) Weather Sunny day (1), cloudy day (1.2), rainy day (1.8), snowy day (1.5), and foggy day (2) Road surface Dryness (1), wetness (1.5), accumulated snow condition (1.8), and ice (2)
[0108] Then, a complexity correction coefficient corresponding to each environment factor in the traveling scenario in which the vehicle is located may be determined by querying the correspondence between a value of each environment factor and a complexity correction coefficient. Subsequently, the determined complexity correction coefficients corresponding to the environment factors are multiplied to obtain the target complexity correction coefficient.
[0109] For example, the obtained value of each environment factor is as follows: The lighting is daytime, the weather is a rainy day, and the road surface condition is wetness. Correspondingly, it may be determined, through query, that a complexity correction coefficient corresponding to the daytime is 1, a complexity correction coefficient corresponding to the rainy day is 1.8, and a complexity correction coefficient corresponding to the wetness is 1.5, and the three complexity correction coefficients are multiplied to obtain the target complexity correction coefficient 2.7.
[0110] Finally, the obtained target complexity correction coefficient is multiplied by a sum of the determined dynamic complexity and the determined static complexity, to obtain the comprehensive complexity of the traveling scenario in which the vehicle is located.
[0111] In a possible implementation, after the comprehensive complexity of the traveling scenario in which the vehicle is located is calculated, whether to provide a manual driving takeover prompt may be determined based on the calculated comprehensive complexity.
[0112] In an implementation, the comprehensive complexity may be displayed on a display screen in the self-driving car in real time, so that a driver can learn of, in real time, the complexity of the traveling environment in which the vehicle is located. In addition, a danger complexity threshold may be set. When the calculated comprehensive complexity is greater than the set danger complexity threshold, the manual driving takeover prompt may be displayed on the display screen. In addition, a voice prompt may be provided at the same time, to prompt the driver to perform manual driving due to a high complexity of a current driving environment.
[0113] In this embodiment of this application, the static complexity of the traveling scenario in which the vehicle is located is determined based on the static information of each static factor in the traveling scenario in which the vehicle is located. In addition, the dynamic complexity of the traveling scenario in which the vehicle is located is further determined based on the traveling speed of the vehicle and the traveling speed of the target vehicle. The target vehicle is a vehicle that meets the preset distance condition with the vehicle. In this way, the comprehensive complexity of the traveling scenario in which the vehicle is located is comprehensively determined by combining the static complexity determined by using the static factor and the dynamic complexity determined by using a traveling status of a surrounding vehicle. The comprehensive complexity may more fully reflect an actual complexity of the traveling scenario in which the vehicle is currently located.
[0114] Based on a same technical concept, an embodiment of this application further provides an apparatus for detecting a complexity of a traveling scenario of a vehicle. As shown in
[0115] In a possible implementation, the first determining module 620 is configured to: obtain, for each target vehicle based on the traveling speed of the vehicle and a traveling speed of the target vehicle, a complexity corresponding to the target vehicle; and add the complexities corresponding to the target vehicles to obtain the dynamic complexity of the traveling scenario in which the vehicle is located.
[0116] In a possible implementation, the first determining module 620 is configured to: obtain a relative traveling speed between the vehicle and the target vehicle based on the traveling speed of the vehicle and the traveling speed of the target vehicle; obtain an included angle θ.sub.ij between a traveling direction of the vehicle and the relative traveling speed between the vehicle and the target vehicle; and obtain, based on the included angle θ.sub.ij, the complexity corresponding to the target vehicle.
[0117] In a possible implementation, the first determining module 620 is configured to: substitute the included angle θ.sub.ij into the following equation:
to obtain an initial complexity f(θ.sub.ij) corresponding to the target vehicle; and correct, based on a distance between the target vehicle and the vehicle and the relative traveling speed between the target vehicle and the vehicle, the initial complexity f(θ.sub.ij) corresponding to the target vehicle, to obtain the complexity corresponding to the target vehicle.
[0118] In a possible implementation, the first determining module 620 is configured to: obtain a first safe distance between the vehicle and the target vehicle based on the traveling speed, a maximum deceleration, and a minimum deceleration of the vehicle, the traveling speed and a maximum deceleration of the target vehicle, and a preset driver reaction time; calculate a first difference between a preset danger distance and a component of the distance between the target vehicle and the vehicle in the traveling direction of the vehicle; calculate a second difference between the first safe distance and the preset danger distance; calculate a ratio between the first difference and the second difference to obtain a standard vertical distance p between the vehicle and the target vehicle; substitute the standard vertical distance P into the following equation: f.sub.1(p)=(1−p)1g(1/p), to obtain a vertical correction coefficient f.sub.1(p); calculate a third difference between a preset danger horizontal relative speed and a horizontal relative speed between the target vehicle and the vehicle; calculate a fourth difference between a preset safe horizontal relative speed and the preset danger horizontal relative speed; calculate a ratio between the third difference and the fourth difference to obtain a standard horizontal relative speed q between the vehicle and the target vehicle; substitute the standard horizontal relative speed q into the following equation: f.sub.1(q)=(1−q)1g(1/q), to obtain a horizontal correction coefficient f.sub.1(q); and multiply the initial complexity f(θ.sub.ij) corresponding to the target vehicle, the vertical correction coefficient f.sub.1(q), and the horizontal correction coefficient f.sub.1(q), to obtain the complexity corresponding to the target vehicle.
[0119] In a possible implementation, the third determining module 640 is configured to: obtain values of the plurality of static factors based on static information of the plurality of static factors, and obtain, based on a correspondence between the values of the plurality of static factors and complexities, complexities respectively corresponding to the plurality of static factors; and obtain, based on the complexities respectively corresponding to the plurality of static factors, the static complexity of the traveling scenario in which the vehicle is located.
[0120] In a possible implementation, the third determining module 640 is configured to: obtain weights respectively corresponding to the plurality of static factors; respectively multiply the complexities corresponding to the values of the plurality of static factors by the corresponding weights to obtain weighted complexities respectively corresponding to the plurality of static factors; and add the weighted complexities corresponding to the plurality of static factors to obtain the static complexity of the traveling scenario in which the vehicle is located.
[0121] In a possible implementation, the apparatus further includes: a counting module, configured to: for a first value of a first static factor, obtain N sample images corresponding to the first value, where N is an integer greater than 1; separately perform image recognition on the N sample images to obtain a predicted value corresponding to each sample image; count a quantity M of sample images whose corresponding predicted values are different from corresponding ground truth values, where the ground truth value is used to uniquely identify the first value; and obtain a ratio of M to N as a complexity corresponding to the first value.
[0122] In a possible implementation, the static factor includes at least one of a road type, a quantity of co-directional lanes, a lane width, a central isolation form, an isolation form between a motor vehicle and a non-motor vehicle, a traffic sign, and a traffic light.
[0123] In a possible implementation, the apparatus further includes: a correction module, configured to: obtain environment information of an environment factor in the traveling scenario in which the vehicle is located; obtain a value of the environment factor based on the environment information of the environment factor; and obtain, based on a stored correspondence between a value of an environment factor and a complexity correction coefficient, a target complexity correction coefficient corresponding to the value of the environment factor in the traveling scenario in which the vehicle is located; and the fourth module 650 is configured to: multiply, by the target complexity correction coefficient, a value obtained by adding the dynamic complexity and the static complexity, to obtain the comprehensive complexity of the traveling scenario in which the vehicle is located.
[0124] In a possible implementation, the environment factor includes at least one of lighting, weather, and a road surface condition.
[0125] In a possible implementation, the obtaining module 610 is configured to: if there is a forward vehicle in a same lane as the vehicle, determine, as a reference vehicle, a forward vehicle that is in the forward vehicle in the same lane as the vehicle and that has a minimum distance from the vehicle; obtain a traveling speed of the reference vehicle and a component of a distance between the reference vehicle and the vehicle in the traveling direction of the vehicle; obtain a second safe distance between the vehicle and the reference vehicle based on the traveling speed, a preset maximum acceleration, and a preset minimum deceleration of the vehicle, the traveling speed and a preset maximum deceleration of the reference vehicle, and the preset driver reaction time; obtain a smaller value in the second safe distance and the component of the distance between the reference vehicle and the vehicle in the traveling direction of the vehicle; and use, as the target vehicle, a forward vehicle in a lane in which the vehicle is located and an adjacent lane, where a component of a distance between the forward vehicle and the vehicle in the traveling direction of the vehicle is not greater than the smaller value; or if there is no forward vehicle in a same lane as the vehicle, obtain a third safe distance based on the traveling speed, a preset maximum acceleration, and a preset minimum deceleration of the vehicle, a preset forward-vehicle traveling speed, the preset maximum deceleration, and the preset driver reaction time, where the preset forward-vehicle traveling speed is 0; and use, as the target vehicle, a forward vehicle in a lane in which the vehicle is located and an adjacent lane, where a component of a distance between the forward vehicle and the vehicle in the traveling direction of the vehicle is not greater than the third safe distance.
[0126] It should be further noted that, when the apparatus for detecting a complexity of a traveling scenario of a vehicle provided in the foregoing embodiment detects the complexity of the traveling scenario of the vehicle, division of the foregoing functional modules is merely used as an example for description. In actual application, the foregoing functions may be allocated to different functional modules and implemented as required, that is, an internal structure of a vehicle traveling decision controller is divided into different functional modules, to implement all or some of the functions described above. In addition, the apparatus for detecting a complexity of a traveling scenario of a vehicle provided in the foregoing embodiment belongs to a same concept as the embodiment of the method for detecting a complexity of a traveling scenario of a vehicle. For a specific implementation process thereof, refer to the method embodiment. Details are not described herein again.
[0127] All or some of the foregoing embodiments may be implemented by using software, hardware, firmware, or any combination thereof. When software is used to implement the embodiments, the embodiments may be implemented all or partially in a form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a device, the procedures or the functions in the embodiments of this application are all or partially generated. The computer instructions may be stored in a computer-readable storage medium, or may be transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired (for example, a coaxial optical cable, an optical fiber, or a digital subscriber line) or wireless (for example, infrared, radio, or microwave) manner. The computer-readable storage medium may be any usable medium accessible by a device, or a data storage device, such as a server or a data center, integrating one or more usable media. The usable medium may be a magnetic medium (such as a floppy disk, a hard disk, and a magnetic tape), or may be an optical medium (such as a digital video disc (DVD)) or a semiconductor medium (such as a solid-state drive).
[0128] A person of ordinary skill in the art may understand that all or some of the steps of the foregoing embodiments may be implemented by hardware or a program instructing related hardware. The program may be stored in a computer-readable storage medium. The storage medium may be a read-only memory, a magnetic disk, a compact disc, or the like.
[0129] The foregoing description is merely optional embodiments of this application, but is not intended to limit this application. Any modification, equivalent replacement, or improvement made without departing from the spirit and principle of this application should fall within the protection scope of this application.