Intelligent light switching method, device, equipment, storage medium and vehicle
By acquiring and matching light source image frames in the vehicle, the problem of unstable switching between high and low beams was solved, achieving more stable lighting control and improving the driving experience and safety.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING CO WHEELS TECH CO LTD
- Filing Date
- 2022-11-18
- Publication Date
- 2026-05-29
AI Technical Summary
In existing technologies, the frequent switching between high and low beam headlights in vehicles leads to a decrease in driving experience and safety, especially when the light source recognition result does not match the actual situation or when the image is lost, resulting in unstable switching.
By acquiring the current frame image of the vehicle's driving direction, the first target light source in the previous frame image is identified as the first tracking light source. The current frame image is then used for light source identification, and the second target light source is matched with the first tracking light source. Based on the matching result, it is determined whether to switch between high and low beam headlights, thus achieving the tracking of the light source status.
It improves the stability of vehicle high and low beam switching and driving safety, avoids frequent headlight switching, and enhances user convenience.
Smart Images

Figure CN116901823B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of vehicle control technology, and in particular to an intelligent headlight switching method, device, equipment, storage medium, and vehicle. Background Technology
[0002] When driving at night, drivers need to switch between low beam and high beam headlights according to the brightness of the surrounding environment and the driving conditions of other vehicles. For example, when the surrounding environment is bright, the vehicle lights should be switched to low beams, and when the surrounding environment is dark, the vehicle lights should be switched to high beams. When there are oncoming vehicles, the driver needs to switch the high beams back to low beams to ensure driving safety.
[0003] Currently, it is possible to identify light sources in images of the vehicle's driving direction and control the switching of high and low beam headlights based on the type of light source in the image. However, this method only switches the lights based on the type of light source in the current frame of the image. When the light source identification result does not match the actual situation or when there are missing frames in the acquired image, it will cause the vehicle's high and low beam headlights to switch frequently, reducing the driving experience and driving safety. Summary of the Invention
[0004] To address the aforementioned technical problems, this disclosure provides an intelligent headlight switching method, apparatus, device, storage medium, and vehicle.
[0005] A first aspect of this disclosure provides an intelligent lighting switching method, the method comprising:
[0006] Acquire the current frame image in the vehicle's direction of travel;
[0007] The first target light source contained in the previous frame of the current frame image is determined as the first tracking light source;
[0008] Perform light source identification on the current frame image to obtain the target light source contained in the current frame image, and determine the target light source contained in the current frame image as the second target light source;
[0009] The second target light source contained in the current frame image is matched with the first tracked light source to obtain the matching result;
[0010] Based on the matching results, determine whether it is necessary to switch between high and low beam headlights.
[0011] A second aspect of this disclosure provides an intelligent lighting switching device, the device comprising:
[0012] The acquisition module is used to acquire the current frame image in the vehicle's driving direction;
[0013] The first determining module is used to determine the first target light source contained in the previous frame image of the current frame image as the first tracking light source;
[0014] The recognition module is used to identify light sources in the current frame image, obtain the target light source contained in the current frame image, and determine the target light source contained in the current frame image as the second target light source.
[0015] The matching module is used to match the second target light source contained in the current frame image with the first tracked light source to obtain the matching result;
[0016] The second determining module is used to determine whether high beam switching is needed based on the matching results.
[0017] A third aspect of this disclosure provides an electronic device, the terminal including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, it can implement the intelligent light switching method of the first aspect described above.
[0018] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the intelligent lighting switching method of the first aspect described above.
[0019] A fifth aspect of this disclosure provides a vehicle that includes the intelligent headlight switching device of the second aspect described above, which can implement the intelligent headlight switching method of the first aspect described above.
[0020] The technical solution provided in this disclosure has the following advantages compared with the prior art:
[0021] In this embodiment, the following steps are taken: First, a first target light source contained in the previous frame of the vehicle's driving direction is acquired. Then, the first target light source is identified as the first tracking light source. Next, light source identification is performed on the current frame to obtain the target light source contained in the current frame, and this target light source is identified as the second target light source. Finally, the second target light source in the current frame is matched with the first tracking light source to obtain a matching result. Based on the matching result, it is determined whether high / low beam switching is necessary. This allows for light source status tracking around the vehicle during nighttime driving. When the light source identification result does not match the actual situation or the acquired image has frame drops, the matching result between the target light source in the current frame and the tracking light source in the previous frame determines whether high / low beam switching is necessary. This ensures that the target light source identified based on the current frame matches the actual situation, avoiding frequent switching of high / low beams and improving the stability of high / low beam switching, as well as the convenience and safety of the user's driving. Attached Figure Description
[0022] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0023] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart of an intelligent light switching method provided in an embodiment of this disclosure;
[0025] Figure 2 This is a flowchart of another intelligent light switching method provided in this disclosure embodiment;
[0026] Figure 3 This is a flowchart of another intelligent light switching method provided in this disclosure embodiment;
[0027] Figure 4 This is a schematic diagram of the structure of an intelligent lighting switching device provided in an embodiment of this disclosure;
[0028] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0029] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0030] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0031] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0032] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0033] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0034] When driving at night, drivers need to switch between low beam and high beam headlights according to the brightness of the surrounding environment and the driving conditions of other vehicles. For example, when the surrounding environment is bright, the vehicle lights should be switched to low beams, and when the surrounding environment is dark, the vehicle lights should be switched to high beams. When there are oncoming vehicles, the driver needs to switch the high beams back to low beams to ensure driving safety.
[0035] Currently, it is possible to identify light sources in images of the vehicle's driving direction and control the switching of high and low beam headlights based on the type of light source in the image. However, this method only switches the lights based on the type of light source in the current frame of the image. When the light source identification result does not match the actual situation or when there are missing frames in the acquired image, it will cause the vehicle's high and low beam headlights to switch frequently, reducing the driving experience and driving safety.
[0036] To address the shortcomings of related technologies in vehicle headlight switching, this disclosure provides an intelligent headlight switching method, device, equipment, storage medium, and vehicle. When a vehicle is driving at night, it tracks the light source status of the lights around the vehicle. When the light source identification result does not match the actual situation or the acquired image has frame drops, it determines whether high / low beam switching is necessary by matching the target light source in the current frame image with the tracked light source in the previous frame image. This ensures that the target light source identified based on the current frame image matches the actual situation, avoiding frequent switching of the vehicle's high / low beam headlights, improving the stability of high / low beam switching, and enhancing the convenience and safety of the user's driving experience.
[0037] The intelligent light switching method provided in this disclosure can be executed by an electronic device. The electronic device can be understood as any device with processing and computing capabilities. The device may include, but is not limited to, mobile terminals such as smartphones, laptops, tablets (PADs), portable multimedia players (PMPs), and in-vehicle terminals (such as in-vehicle navigation terminals), as well as fixed electronic devices such as digital TVs and desktop computers.
[0038] To better understand the inventive concept of the embodiments of this disclosure, the technical solutions of the embodiments of this disclosure will be described below in conjunction with exemplary embodiments.
[0039] Figure 1 This is a flowchart of an intelligent light switching method provided in an embodiment of this disclosure, such as... Figure 1 As shown, the intelligent light switching method provided in this embodiment may include steps 110-150:
[0040] Step 110: Obtain the current frame image in the vehicle's driving direction.
[0041] In this embodiment, the vehicle is equipped with electronic devices and image acquisition devices. The image acquisition devices can capture images and may include in-vehicle cameras, vehicle-mounted cameras, etc. The electronic devices can establish a communication connection with the image acquisition devices. When the vehicle is driving at night, the image acquisition devices can capture images in the direction of the vehicle's travel, and the electronic devices can obtain images in the direction of the vehicle's travel from the image acquisition devices. The current frame image can be understood as the image in the direction of the vehicle's travel that the electronic devices obtain from the image acquisition devices at the current moment.
[0042] Step 120: Determine the first target light source contained in the previous frame of the current frame image as the first tracking light source.
[0043] In this embodiment of the present disclosure, the electronic device can identify the light source in the previous frame of the current frame image, obtain the first target light source contained in the previous frame image, and determine the first target light source as the first tracking light source.
[0044] In this embodiment of the disclosure, the light source can be understood as an object capable of emitting visible light. The light source in the image can include all light sources around the vehicle, such as headlights, taillights, streetlights, ambient light, reflections, and other light sources. Headlights can be understood as headlights installed at the front of the vehicle, taillights can be understood as headlights installed at the rear of the vehicle, streetlights can be understood as lights located on the road where the vehicle is traveling, ambient light can be understood as light sources in the natural environment, such as moonlight, reflections can be understood as light reflected from the surface of an object after it shines on it, and other light sources can be understood as light sources other than headlights, taillights, streetlights, ambient light, and reflections.
[0045] The target light source in this embodiment can be understood as a light source related to the switching of high and low beam headlights. The target light source may include taillights, headlights, and streetlights.
[0046] In some embodiments, determining the first target light source contained in the previous frame image of the current frame image as the first tracking light source may include steps 1201-1203:
[0047] Step 1201: Perform light source detection on the previous frame image based on the light source detection network to obtain the light sources contained in the previous frame image.
[0048] In this embodiment of the present disclosure, the electronic device can input the previous frame image into the light source detection network, and based on the light source detection network, detect the light source in the previous frame image to obtain the light source contained in the previous frame image.
[0049] In some embodiments, performing light source detection on the previous frame image based on a light source detection network to obtain the light sources contained in the previous frame image may include S11-S13:
[0050] S11. Input the previous frame image into the light source detection network. Based on the light source detection network, detect the light sources in the previous frame image to obtain the light source detection data of the previous frame image. The light source detection data includes the position data of the bounding boxes corresponding to each light source in the previous frame image.
[0051] In this embodiment, the electronic device can input the previous frame image into a light source detection network. The light source detection network can identify the light sources in the previous frame image and use bounding boxes to enclose a preset area containing each light source in the previous frame image for annotation. Then, it calculates the coordinates of any two opposite corners of the bounding box in the image, i.e., the coordinates of the upper left and lower right corners or the lower left and upper right corners. The coordinates of the two opposite corners uniquely determine the size of the bounding box. The coordinates of the two opposite corners of the bounding box corresponding to the light source in the previous frame image are the position data of the bounding box corresponding to that light source in the previous frame image. Here, the bounding box can be understood as a rectangular box, and the light source detection data can include the position data of the bounding boxes corresponding to each light source in the previous frame image.
[0052] The light source detection network in this embodiment may include a YOLOv5-based target detection network, which may include a feature extraction layer (Backbone), a feature fusion layer (Neck), and a target detection layer (Head).
[0053] S12. Based on the position data of the bounding box corresponding to the light source in the previous frame image, extract the light source region image corresponding to the light source.
[0054] In this embodiment of the present disclosure, the electronic device can determine the rectangular frame boundary determined by the coordinates of the two opposite corners of the annotation box based on the position data of the annotation box in the previous frame image, and then extract the image area determined by the rectangular frame boundary to obtain the light source area image corresponding to the light source.
[0055] S13. Determine the light source in the light source region image as the light source contained in the previous frame image.
[0056] In this embodiment of the present disclosure, the electronic device can determine the light source in the light source area image as the light source contained in the previous frame image.
[0057] Step 1202: Classify the light sources based on the light source classification network and determine the first target light source among them.
[0058] In this embodiment of the disclosure, the electronic device can classify light sources based on a light source classification network to determine the first target light source among the light sources.
[0059] In some embodiments, classifying light sources based on a light source classification network to determine a first target light source may include steps S21-S24:
[0060] S21. Input the light source region image into the light source classification network. Based on the light source classification network, classify the light sources in the light source region image to obtain the initial category of the light source.
[0061] In this embodiment of the present disclosure, after obtaining the light source images corresponding to each light source, the electronic device can input the light source images into a light source classification network. Based on the light source classification network, the light sources in the light source images are classified to obtain the initial category of the light source. The initial category may include headlights, taillights, streetlights, ambient light, reflections, and other light sources.
[0062] The light source classification network in this embodiment may include a VarGnet-based classification network. VarGnet refers to a variable grouped convolutional network, which can be understood as a feature extraction network. Specifically, after obtaining the light source images corresponding to each light source, the electronic device can input the light source images into the light source classification network. The VarGnet network in the light source classification network can extract features from the light source images, obtaining multiple VarGnet features. Then, the VarGnet features are input into various multi-layer perceptrons (MLPs), and the light sources in the light source images are classified based on the multi-layer perceptrons to obtain the initial category of the light source.
[0063] S22. Determine whether the initial category is the target category.
[0064] The target category in this disclosure can be understood as the light source category related to the switching of high and low beams, which may include headlights, taillights, and streetlights.
[0065] In this embodiment of the disclosure, the electronic device can determine whether the initial category is the target category.
[0066] S23. If the initial category is the target category, then the light source corresponding to the initial category is determined as the first target light source.
[0067] In this embodiment of the disclosure, if the initial category is the target category, the electronic device can determine the light source corresponding to the initial category as the first target light source.
[0068] S24. If the initial category is not the target category, then the light source corresponding to the initial category will be removed.
[0069] In this embodiment of the disclosure, if the initial category is not the target category, the electronic device can eliminate the light source corresponding to the initial category.
[0070] Step 1203: Determine the first target light source as the first tracking light source.
[0071] In this embodiment of the disclosure, after obtaining the first target light source contained in the previous frame image of the current frame image, the first target light source can be determined as the first tracking light source. The first target light source and the first tracking light source correspond one-to-one.
[0072] Step 130: Perform light source identification on the current frame image to obtain the target light source contained in the current frame image, and determine the target light source contained in the current frame image as the second target light source.
[0073] In this embodiment of the present disclosure, the electronic device can perform light source identification on the current frame image, obtain the target light source contained in the current frame image, and determine the target light source contained in the current frame image as the second target light source.
[0074] Specifically, performing light source identification on the current frame image to obtain the target light source contained in the current frame image, and determining the target light source contained in the current frame image as the second target light source, may include steps 1301-1303:
[0075] Step 1301: Perform light source detection on the current frame image based on the light source detection network to obtain the light sources contained in the current frame image.
[0076] Step 1302: Classify the light sources based on the light source classification network and determine the target light source among them.
[0077] The content of steps 1301-1302 in this embodiment can be referred to the relevant content of steps 1201-1202 above, and will not be repeated here.
[0078] Step 1303: Determine the target light source as the second tracking light source.
[0079] Step 140: Match the second target light source contained in the current frame image with the first tracking light source to obtain the matching result.
[0080] In this embodiment of the disclosure, the second target light source can be understood as a light source related to the switching of high and low beam headlights. The second target light source may include taillights, headlights, and streetlights.
[0081] In this embodiment of the present disclosure, after determining the first tracking light source, the electronic device can perform light source state tracking on the first tracking light source, that is, in the current frame image, the second target light source contained in the current frame image is matched with the first tracking light source to obtain the matching result of the second target light source and the first tracking light source contained in the current frame image.
[0082] Step 150: Based on the matching results, determine whether it is necessary to switch between high and low beam headlights.
[0083] In this embodiment of the disclosure, after obtaining the matching result between the second target light source and the first tracking light source contained in the current frame image, the electronic device can determine whether it is necessary to switch between high and low beams based on the matching result. The matching result may include a match between the second target light source and the first tracking light source, or a mismatch between the second target light source and the first tracking light source.
[0084] In some embodiments, determining whether high beam / low beam switching is needed based on the matching results may include steps 1501-1503:
[0085] Step 1501: If the second target light source matches the first tracking light source, then it is determined that the second target light source and the first tracking light source are the same, and there is no need to switch between high and low beams.
[0086] In this embodiment of the disclosure, if the second target light source matches the first tracking light source, it means that the second target light source and the first tracking light source are the same light source. The electronic device can determine that the second target light source and the first tracking light source are the same, and there is no need to switch between high and low beam lights.
[0087] In some embodiments, if the second target light source matches the first tracking light source, after determining that the second target light source and the first tracking light source are the same, the electronic device can also update the Kalman filter corresponding to the first tracking light source, determine the first tracking light source as the tracking light source in the current frame image, and determine the tracking light source in the current frame image as the second tracking light source.
[0088] Step 1502: If the second target light source does not match the first tracking light source, then the second target light source is determined to be different from the first tracking light source. A corresponding Kalman filter is constructed for the second target light source, and the second target light source and the first tracking light source are determined as the tracking light sources in the current frame image, and the tracking light source in the current frame image is determined as the second tracking light source.
[0089] In this embodiment of the present disclosure, if the second target light source does not match the first tracking light source, it indicates that the second target light source and the first tracking light source are different light sources. The electronic device can determine that the second target light source and the first tracking light source are different, construct a corresponding Kalman filter for the second target light source, and determine the second target light source and the first tracking light source as the tracking light source in the current frame image, and determine the tracking light source in the current frame image as the second tracking light source.
[0090] In other embodiments, if the second target light source does not match the first tracking light source, it is determined that the second target light source is different from the first tracking light source. A corresponding Kalman filter is constructed for the second target light source, and the second target light source and the first tracking light source are determined as tracking light sources in the current frame image. After determining the tracking light source in the current frame image as the second tracking light source, the process may further include S31-S33:
[0091] S31. Obtain the first preset number of frame images after the current frame image;
[0092] In this embodiment of the present disclosure, the electronic device can acquire a first preset number of frame images after the current frame image. The first preset number can be determined based on a first preset time period after the current frame time of the current frame image, and can also be set according to actual needs. No specific limitation is made here.
[0093] The specific settings will be determined based on actual needs, and no specific limitations will be made here.
[0094] S32. For each frame in the first preset number of frames, determine the matching result between the target light source and the second tracking light source contained in the image.
[0095] In this embodiment of the present disclosure, for each frame of the first preset number of frames, the electronic device can determine the target light source contained in the image, and match the target light source contained in the image with the second tracking light source to obtain the matching result corresponding to the image.
[0096] S33. If the second tracking light source does not match the target light source contained in each frame of the first preset number of frames, then the second tracking light source and the Kalman filter corresponding to the second tracking light source are removed.
[0097] In this embodiment of the present disclosure, if the second tracking light source does not match the target light source contained in each frame of the first preset number of frames, the electronic device can determine that the second tracking light source has disappeared in the direction of vehicle travel, and the electronic device can remove the second tracking light source and the Kalman filter corresponding to the second tracking light source.
[0098] Step 1503: Based on the type of the second tracking light source and the vehicle's lighting status, control the vehicle to switch between high and low beam headlights.
[0099] In this embodiment of the disclosure, the category of the second tracking light source may include a first category, a second category, and a third category. The first category may include headlights, the second category may include taillights, and the third category may include streetlights.
[0100] In this embodiment of the disclosure, the electronic device can control the vehicle to switch between high and low beam headlights based on the type of the second tracking light source and the vehicle's lighting status.
[0101] In some embodiments, controlling the vehicle to switch between high and low beam headlights based on the type of the second tracking light source and the vehicle's lighting status may include S41-S47:
[0102] S41. Determine whether the first type of light source exists in the second tracking light source and the vehicle's lighting status.
[0103] In this embodiment of the disclosure, after obtaining the second tracking light source, the electronic device can determine whether there is a first type of light source in the second tracking light source and the vehicle's lighting status, that is, whether there are headlights in the second tracking light source, and the vehicle's lighting status includes low beam headlights on or high beam headlights on.
[0104] S42. If there is a first-category light source among the second tracking light sources and the vehicle's headlights are not in the low beam mode, then control the vehicle to switch to low beam mode.
[0105] In this embodiment of the disclosure, if there is a first type of light source in the second tracking light source, it means that there are other vehicles with their lights on in the opposite direction of the vehicle's travel direction. At this time, the vehicle needs to turn on its low beam headlights. If the vehicle's headlight status is not low beam headlights on, the electronic device can control the vehicle to switch to low beam headlights. If the headlight status is low beam headlights on, the vehicle does not need to switch its headlights.
[0106] S43. If there is no first category light source in the second tracking light source, then determine whether there is a second category light source in the second tracking light source and whether the distance between the second category light source and the vehicle is less than or equal to a preset distance threshold.
[0107] In this embodiment of the disclosure, if the first type of light source is not present in the second tracking light source, it indicates that there are no other vehicles with their lights on in the opposite direction of the vehicle's travel. The electronic device can then further determine whether a second type of light source exists in the second tracking light source and whether the distance between the second type of light source and the vehicle is less than or equal to a preset distance threshold. Specifically, it can determine whether a taillight exists in the second tracking light source and whether the distance between the taillight and the vehicle is less than or equal to the preset distance threshold. This preset distance threshold can be set according to actual needs and is not specifically limited here. The distance between the second type of light source and the vehicle can be obtained by ranging using a lidar sensor installed on the vehicle.
[0108] S44. If there is a second type of light source in the second tracking light source and the distance between the second type of light source and the vehicle is less than or equal to a preset distance threshold and the vehicle's lighting status is not low beam on, then control the vehicle to switch to low beam.
[0109] In this embodiment of the disclosure, if there is a second type of light source among the second tracking light sources, it indicates that there are other vehicles with their taillights on ahead of the vehicle in the direction of travel. At this time, if the distance between the second type of light source and the vehicle is less than or equal to a preset distance threshold, it indicates that the vehicle is close to other vehicles. At this time, the vehicle needs to turn on its low beam headlights. If the vehicle's headlights are not in the low beam headlights on state at this time, the electronic device can control the vehicle to switch to low beam headlights. If the headlights are in the low beam headlights on state, the vehicle does not need to switch its headlights.
[0110] S45. If there is no second type of light source in the second tracking light source or the distance between the second type of light source and the vehicle is greater than a preset distance threshold, then determine whether there is a third type of light source in the second tracking light source and whether the brightness state of the third type of light source belongs to the preset brightness state.
[0111] In some embodiments of this disclosure, if there is no second type of light source in the second tracking light source, it means that there are no other vehicles traveling in front of the vehicle in the direction of travel. Then the electronic device can further determine whether there is a third type of light source in the second tracking light source and whether the brightness state of the third type of light source belongs to a preset brightness state, that is, determine whether there is a street lamp in the second tracking light source and whether the brightness state of the street lamp belongs to a preset brightness state. The preset brightness state can be understood as a state with higher brightness, which can be set as needed, and is not specifically limited here.
[0112] In some other embodiments of this disclosure, if there is a second type of light source in the second tracking light source but the distance between the second type of light source and the vehicle is greater than a preset distance threshold, indicating that the vehicle is far away from other vehicles, the electronic device can further determine whether there is a third type of light source in the second tracking light source and whether the brightness state of the third type of light source belongs to a preset brightness state.
[0113] S46. If there is a third type of light source in the second tracking light source and the brightness state of the third type of light source is a preset brightness state and the vehicle's light state is not low beam on, then control the vehicle to switch to low beam.
[0114] In this embodiment of the disclosure, if there is a third type of light source in the second tracking light source and the brightness state of the third type of light source is a preset brightness state, it means that there are streetlights on the road where the vehicle is driving and the streetlights are bright. At this time, the vehicle can turn on the low beam headlights. If the vehicle's light state is not the low beam headlights on state, the electronic device can control the vehicle to switch to low beam headlights. If the light state is the low beam headlights on state, the vehicle does not need to switch the lights.
[0115] S47. If there is no third type of light source in the second tracking light source and the vehicle's lighting status is not high beam on, or if the brightness status of the third type of light source is not a preset brightness status and the vehicle's lighting status is not high beam on, then control the vehicle to switch to high beam.
[0116] In some embodiments of this disclosure, if there is no third type of light source in the second tracking light source, it means that there are no streetlights on the road where the vehicle is traveling. At this time, the vehicle needs to turn on the high beams. If the vehicle's light status is not high beam on at this time, the electronic device can control the vehicle to switch to high beams. If the light status is not high beam on, the vehicle does not need to control the vehicle to switch to high beams.
[0117] In some other embodiments of this disclosure, if there is a third type of light source in the second tracking light source but the brightness state of the third type of light source is not a preset brightness state, it means that although there are streetlights on the road where the vehicle is traveling, the brightness of the streetlights is low. At this time, the vehicle needs to turn on the high beams. If the vehicle's light state is not the high beams on state at this time, the electronic device can control the vehicle to switch to high beams. If the light state is not the high beams on state, the vehicle does not need to control the vehicle to switch to high beams.
[0118] In this embodiment, the following steps are taken: First, a first target light source contained in the previous frame of the vehicle's driving direction is acquired. Then, the first target light source is identified as the first tracking light source. Next, light source identification is performed on the current frame to obtain the target light source contained in the current frame, and this target light source is identified as the second target light source. Finally, the second target light source in the current frame is matched with the first tracking light source to obtain a matching result. Based on the matching result, it is determined whether high / low beam switching is necessary. This allows for light source status tracking around the vehicle during nighttime driving. When the light source identification result does not match the actual situation or the acquired image has frame drops, the matching result between the target light source in the current frame and the tracking light source in the previous frame determines whether high / low beam switching is necessary. This ensures that the target light source identified based on the current frame matches the actual situation, avoiding frequent switching of high / low beams and improving the stability of high / low beam switching, as well as the convenience and safety of the user's driving.
[0119] Figure 2 This is a flowchart of an intelligent light switching method provided in an embodiment of this disclosure, such as... Figure 2 As shown, the intelligent light switching method provided in this embodiment may include steps 210-280:
[0120] Step 210: Obtain the current frame image in the vehicle's driving direction.
[0121] Step 220: Determine the first target light source contained in the previous frame of the current frame image as the first tracking light source.
[0122] Step 230: Perform light source identification on the current frame image to obtain the target light source contained in the current frame image, and determine the target light source contained in the current frame image as the second target light source.
[0123] Steps 210-230 in this embodiment can refer to the content of steps 110-130 above, and will not be repeated here.
[0124] Step 240: Based on the Kalman filter corresponding to the first tracking light source, predict the position of the first tracking light source in the current frame image to obtain the predicted position of the first tracking light source.
[0125] In this embodiment of the disclosure, the predicted position of the first tracking light source can be understood as the predicted position of the bounding box corresponding to the first tracking light source in the current frame image.
[0126] In this embodiment, each first tracking light source corresponds to a Kalman filter. Kalman filtering is an algorithm that uses the state equations of a linear system to make an optimal estimate of the system state based on the system's input and output observation data. For details, please refer to relevant technologies; further explanation is omitted here.
[0127] In this embodiment of the present disclosure, after determining the first tracking light source, the electronic device can input the first tracking light source into the Kalman filter corresponding to the first tracking light source in the current frame image, and predict the position of the first tracking light source in the current frame image based on the Kalman filter corresponding to the first tracking light source to obtain the predicted position of the first tracking light source.
[0128] In some embodiments, predicting the position of the first tracking light source in the current frame image based on the Kalman filter corresponding to the first tracking light source to obtain the predicted position of the first tracking light source may include steps 2401-2403:
[0129] Step 2401: Based on the Kalman filter corresponding to the first tracking light source, predict the trajectory of the first tracking light source from the previous frame image to the current frame image.
[0130] In this embodiment of the present disclosure, after the electronic device inputs the first tracking light source into the Kalman filter corresponding to the first tracking light source, it can predict the trajectory of the first tracking light source from the previous frame image to the current frame image based on the Kalman filter corresponding to the first tracking light source, that is, predict the trajectory of the first tracking light source moving from the first frame time corresponding to the previous frame image to the current frame time corresponding to the current frame image.
[0131] Step 2402: Based on the trajectory, determine the position of the first tracking light source in the current frame image.
[0132] In this embodiment of the present disclosure, after obtaining the trajectory of the first tracking light source from the previous frame image to the current frame image, the Kalman filter corresponding to the first tracking light source can determine the position of the first tracking light source in the current frame image based on the trajectory.
[0133] Step 2403: Determine the position of the first tracking light source at the current frame time as the predicted position of the first tracking light source.
[0134] In this embodiment of the present disclosure, after determining the position of the first tracking light source in the current frame image, the position of the first tracking light source at the current frame time can be determined as the predicted position of the first tracking light source, that is, the predicted position of the bounding box corresponding to the first tracking light source in the current frame image.
[0135] Step 250: Perform light source identification on the current frame image to obtain the actual position of the second target light source in the current frame image.
[0136] In this embodiment of the disclosure, the actual position of the second target light source can be understood as the position of the annotation box corresponding to the second target light source in the current frame image.
[0137] In this embodiment of the disclosure, the electronic device can perform light source identification on the current frame image to obtain the actual position of the second target light source in the current frame image.
[0138] In some embodiments, performing light source identification on the current frame image to obtain the actual position of the second target light source in the current frame image may include steps 2501-2506:
[0139] Step 2501: Input the current frame image into the light source detection network. Based on the light source detection network, detect the light sources in the current frame image to obtain the light source detection data of the current frame image. The light source detection data includes the position data of the bounding boxes corresponding to each light source in the current frame image.
[0140] Step 2502: Based on the position data of the bounding box corresponding to the light source in the current frame image, extract the light source region image corresponding to the light source.
[0141] Step 2503: Input the light source region image into the light source classification network. Based on the light source classification network, classify the light sources in the light source region image to obtain the initial category of the light source.
[0142] Step 2504: Determine whether the initial category is the target category.
[0143] Step 2505: If the initial category is the target category, then the light source corresponding to the initial category is determined as the second target light source. Based on the position data of the bounding box corresponding to the second target light source in the current frame image, the actual position of the second target light source in the current frame image is determined.
[0144] Step 2506: If the initial category is not the target category, then the light source corresponding to the initial category will be removed.
[0145] Steps 2501-2506 in this embodiment can be referred to the relevant content in steps 1101-1103 above, and will not be repeated here.
[0146] Step 260: Based on the actual position of the second target light source and the predicted position of the first tracking light source, perform Hungarian matching to obtain the matching result.
[0147] In this embodiment of the present disclosure, after obtaining the actual position of the second target light source in the current frame image and the predicted position of the first tracking light source in the current frame image, the electronic device can perform Hungarian matching based on the actual position of the second target light source and the predicted position of the first tracking light source to obtain the matching result.
[0148] In this embodiment, Hungarian matching can be understood as a combinatorial optimization algorithm for solving the task allocation problem in polynomial time. It can be used for target tracking. For details, please refer to relevant technologies, which will not be elaborated here.
[0149] The matching results in this embodiment may include a match between the second target light source and the first tracking light source, or a mismatch between the second target light source and the first tracking light source.
[0150] In some embodiments, Hungarian matching is performed based on the actual position of the second target light source and the predicted position of the first tracking light source to obtain a matching result, which may include steps 2601-2603:
[0151] Step 2601: Calculate the intersection-union ratio (IUGR) between the actual bounding box region corresponding to the actual location and the predicted bounding box region corresponding to the predicted location.
[0152] The actual bounding box region in this embodiment can be understood as the pixel region included in the current frame image of the bounding box corresponding to the second target light source, and the predicted bounding box region can be understood as the pixel region included in the current frame image of the bounding box corresponding to the first tracking light source.
[0153] In this embodiment of the disclosure, the intersection-over-union ratio is IoU (Intersection over Union), which can be understood as the ratio of the area of intersection of two bounding boxes to the area of union.
[0154] In this embodiment of the disclosure, the electronic device can calculate the intersection area of the actual annotation box area and the predicted annotation box area, calculate the union area of the actual annotation box area and the predicted annotation box area, and then calculate the ratio of the intersection area to the union area to obtain the intersection-union ratio.
[0155] Step 2602: Based on the intersection-union ratio corresponding to the second target light source, construct the similarity matrix between the second target light source and the first tracking light source contained in the current frame image.
[0156] In this embodiment of the disclosure, after obtaining the intersection-union ratio (IU) between the actual bounding box region corresponding to the actual position of each second target light source and the predicted bounding box region corresponding to the predicted position, a similarity matrix between the second target light source and the first tracking light source contained in the current frame image can be constructed based on the IU of each second target light source.
[0157] Step 2603: Perform Hungarian matching based on the similarity matrix to obtain the matching results.
[0158] In this embodiment of the disclosure, after obtaining the similarity matrix between the second target light source and the first tracking light source contained in the current frame image, Hungarian matching can be performed based on the similarity matrix and the Hungarian algorithm to obtain the matching result.
[0159] Step 270: Based on the matching results, determine whether it is necessary to switch between high and low beam headlights.
[0160] The steps in this embodiment can be referred to step 150 above, and will not be repeated here.
[0161] Therefore, the state tracking of the light source can be achieved based on Kalman filter and Hungarian matching. The tracked light source can be updated in a timely manner according to the matching result, ensuring that the target light source identified based on the current frame image matches the actual situation. This avoids frequent switching of vehicle high and low beam headlights, improves the stability of vehicle high and low beam headlight switching, and enhances the convenience and safety of user driving.
[0162] Figure 3 This is a flowchart of an intelligent light switching method provided in an embodiment of this disclosure, such as... Figure 3 As shown, the intelligent light switching method provided in this embodiment may include steps 301-311:
[0163] Step 301: Obtain the current frame image in the vehicle's driving direction.
[0164] Step 302: Determine the first target light source contained in the previous frame of the current frame image as the first tracking light source.
[0165] Step 303: Perform light source identification on the current frame image to obtain the target light source contained in the current frame image, and determine the target light source contained in the current frame image as the second target light source.
[0166] Step 304: Match the second target light source contained in the current frame image with the first tracking light source to obtain the matching result.
[0167] Steps 301-304 in this embodiment can refer to the content of steps 110-140 above, and will not be repeated here.
[0168] Step 305: Obtain the second preset number of frame images after the current frame image.
[0169] In this embodiment of the present disclosure, the electronic device can acquire a second preset number of frame images after the current frame image. The second preset number can be determined based on a second preset time period after the current frame time of the current frame image, or it can be set according to actual needs, and is not specifically limited here.
[0170] Step 306: For each frame in the second preset number of frames, determine the matching result between the target light source and the first tracking light source contained in the image.
[0171] In this embodiment of the present disclosure, for each frame of the second preset number of frames, the electronic device can determine the target light source contained in the image and match the target light source contained in the image with the first tracking light source to obtain the matching result corresponding to the image.
[0172] Step 307: If the second target light source in the current frame image matches the first tracking light source, then count the first number of image frames corresponding to the result of the target light source matching the first tracking light source in each frame image of the second preset number of frames.
[0173] In this embodiment of the present disclosure, if the second target light source in the current frame image matches the first tracking light source, the electronic device can count the first number of image frames corresponding to the result of the target light source matching the first tracking light source in each frame image in the second preset number of frame images.
[0174] Step 308: If the first quantity is greater than the preset threshold, then the second target light source is determined to match the first tracking light source, and there is no need to switch between high and low beams.
[0175] In this embodiment of the disclosure, if the first quantity is greater than a preset threshold, the electronic device can determine that the second target light source matches the first tracking light source and that the second target light source is the same as the first tracking light source, without needing to switch between high and low beams.
[0176] Step 309: If the second target light source in the current frame image does not match the first tracking light source, then count the second number of image frames corresponding to the result of the target light source and the first tracking light source not matching in each frame image in the second preset number of frame images.
[0177] In this embodiment of the present disclosure, if the second target light source in the current frame image does not match the first tracking light source, the electronic device can count the second number of image frames corresponding to the result of the mismatch between the target light source and the first tracking light source in each frame image of the second preset number of frame images.
[0178] Step 310: If the second quantity is greater than the preset threshold, it is determined that the second target light source and the first tracking light source do not match. A corresponding Kalman filter is constructed for the second target light source, and the second target light source and the first tracking light source are determined as the third tracking light source.
[0179] In this embodiment of the present disclosure, if the second quantity is greater than a preset threshold, the electronic device can determine that the second target light source and the first tracking light source do not match, construct a corresponding Kalman filter for the second target light source, and determine the second target light source and the first tracking light source as the third tracking light source.
[0180] Step 311: Based on the type of the third tracking light source and the vehicle's lighting status, control the vehicle to switch between high and low beam headlights.
[0181] In this embodiment of the disclosure, the electronic device can control the vehicle to switch between high and low beam headlights based on the type of the third tracking light source and the vehicle's lighting status. For details, please refer to the relevant content of S31-S37 above, which will not be repeated here.
[0182] Therefore, based on the matching results of multiple frames of images and the tracked light source, the vehicle can be controlled to switch between high and low beams, improving the stability of the vehicle's high and low beam switching as well as the convenience and safety of the user's driving.
[0183] Figure 4 This is a schematic diagram of the structure of an intelligent lighting switching device provided in an embodiment of this disclosure. This device can be understood as the aforementioned electronic device or a functional module within the aforementioned electronic device. Figure 4 As shown, the intelligent lighting switching device 400 may include:
[0184] The acquisition module 410 is used to acquire the current frame image in the vehicle's driving direction;
[0185] The first determining module 420 is used to determine the first target light source contained in the previous frame image of the current frame image as the first tracking light source;
[0186] The recognition module 430 is used to perform light source recognition on the current frame image, obtain the target light source contained in the current frame image, and determine the target light source contained in the current frame image as the second target light source;
[0187] The matching module 440 is used to match the second target light source contained in the current frame image with the first tracked light source to obtain a matching result;
[0188] The second determining module 450 is used to determine whether high beam switching is needed based on the matching results.
[0189] Optionally, the first determining module 410 described above may include:
[0190] The light source detection submodule is used to perform light source detection on the previous frame image based on the light source detection network to obtain the light sources contained in the previous frame image;
[0191] The classification submodule is used to classify light sources based on the light source classification network and determine the first target light source among them;
[0192] The first determining submodule is used to determine the first target light source as the first tracking light source.
[0193] Optionally, the matching module 440 mentioned above may include:
[0194] The prediction submodule is used to predict the position of the first tracking light source in the current frame image based on the Kalman filter corresponding to the first tracking light source, so as to obtain the predicted position of the first tracking light source.
[0195] The recognition submodule is used to perform light source recognition on the current frame image to obtain the second target light source contained in the current frame image and the actual position of the second target light source in the current frame image.
[0196] The matching submodule is used to perform Hungarian matching based on the actual position of the second target light source and the predicted position of the first tracking light source to obtain the matching result.
[0197] Optionally, the prediction submodule described above may include:
[0198] The prediction unit is used to predict the trajectory of the first tracking light source from the previous frame image to the current frame image based on the Kalman filter corresponding to the first tracking light source.
[0199] The first determining unit is used to determine the position of the first tracking light source in the current frame image based on the trajectory;
[0200] The second determining unit is used to determine the position of the first tracking light source in the current frame image as the predicted position of the first tracking light source.
[0201] Optionally, the above matching submodule may include:
[0202] The calculation unit is used to calculate the intersection-union ratio between the actual bounding box region corresponding to the actual location and the predicted bounding box region corresponding to the predicted location.
[0203] The construction unit is used to construct a similarity matrix between the second target light source and the first tracking light source in the current frame image based on the intersection-union ratio corresponding to the second target light source.
[0204] The matching unit is used to perform Hungarian matching based on the similarity matrix to obtain the matching results.
[0205] Optionally, the above matching results include the second target light source matching the first tracking light source and the second target light source not matching the first tracking light source.
[0206] Optionally, the above matching results include the second target light source matching the first tracking light source and the second target light source not matching the first tracking light source;
[0207] Optionally, the second determining module 450 described above may include:
[0208] The second determining submodule is used to determine that if the second target light source matches the first tracking light source, the second target light source is the same as the first tracking light source, and there is no need to switch between high and low beam lights.
[0209] The third determination submodule is used to determine that the second target light source is different from the first tracking light source if the second target light source does not match the first tracking light source, construct a corresponding Kalman filter for the second target light source, determine the second target light source and the first tracking light source as the tracking light source in the current frame image, and determine the tracking light source in the current frame image as the second tracking light source;
[0210] The first control submodule is used to control the vehicle to switch between high and low beam headlights based on the type of the second tracking light source and the vehicle's lighting status.
[0211] Optionally, the second determining module 450 described above may include:
[0212] The update submodule is used to update the Kalman filter corresponding to the first tracking light source, determine the first tracking light source as the tracking light source in the current frame image, and determine the tracking light source in the current frame image as the second tracking light source.
[0213] Optionally, the second determining module 450 described above may include:
[0214] The first acquisition submodule is used to acquire a first preset number of frame images after the current frame image;
[0215] The fourth determining submodule is used to determine the matching result between the target light source and the second tracking light source in each frame of the first preset number of frames;
[0216] The elimination submodule is used to eliminate the second tracking light source and the Kalman filter corresponding to the second tracking light source if the second tracking light source does not match the target light source contained in each frame of the first preset number of frames.
[0217] Optionally, the above control submodule includes:
[0218] The first judgment unit is used to determine whether there is a first type of light source in the second tracking light source and the vehicle's lighting status;
[0219] The first control unit is used to control the vehicle to switch to low beam headlights if there is a first type of light source among the second tracking light sources and the vehicle's headlight status is not low beam headlights on.
[0220] The second judgment unit is used to determine whether there is a second type of light source in the second tracking light source and whether the distance between the second type of light source and the vehicle is less than or equal to a preset distance threshold if there is no first type of light source in the second tracking light source.
[0221] The second control unit is used to control the vehicle to switch to low beam headlights if there is a second type of light source in the second tracking light source and the distance between the second type of light source and the vehicle is less than or equal to a preset distance threshold and the vehicle's headlight status is not low beam headlights on.
[0222] The third judgment unit is used to determine whether there is a third type of light source in the second tracking light source and whether the brightness state of the third type of light source belongs to the preset brightness state if there is no second type of light source in the second tracking light source or the distance between the second type of light source and the vehicle is greater than a preset distance threshold.
[0223] The third control unit is used to control the vehicle to switch to low beam headlights if there is a third type of light source in the second tracking light source and the brightness state of the third type of light source is a preset brightness state and the vehicle's headlight state is not low beam headlights on.
[0224] The fourth control unit is used to control the vehicle to switch to high beams if there is no third type of light source in the second tracking light source and the vehicle's lighting status is not high beam on, or if the brightness status of the third type of light source is not a preset brightness status and the vehicle's lighting status is not high beam on.
[0225] Optionally, the second determining module 450 described above may include:
[0226] The first acquisition submodule is used to acquire a second preset number of frame images after the current frame image;
[0227] The fifth determining submodule is used to determine the matching result between the target light source and the first tracking light source in each frame of the second preset number of frames;
[0228] The first statistics submodule is used to count the first number of image frames corresponding to the result of the target light source matching the first tracking light source in each of the second preset number of frame images if the second target light source in the current frame image matches the first tracking light source.
[0229] The sixth determining submodule is used to determine that the second target light source matches the first tracking light source if the first quantity is greater than a preset threshold, without needing to switch between high and low beams.
[0230] The second statistics submodule is used to count the second number of image frames corresponding to the result of the mismatch between the target light source and the first tracking light source in each of the second preset number of frame images if the second target light source in the current frame image does not match the first tracking light source.
[0231] The seventh determination submodule is used to determine that the second target light source and the first tracking light source do not match if the second quantity is greater than a preset threshold, construct a corresponding Kalman filter for the second target light source, and determine the second target light source and the first tracking light source as the third tracking light source;
[0232] The second control submodule is used to control the vehicle to switch between high and low beam headlights based on the type of the third tracking light source and the vehicle's lighting status.
[0233] The intelligent light switching device provided in this embodiment can implement the method of any of the above embodiments, and its execution method and beneficial effects are similar, so they will not be described again here.
[0234] This disclosure also provides an electronic device, which includes a processor and a memory. The memory stores a computer program, which, when executed by the processor, can implement the methods of any of the above embodiments. The execution method and beneficial effects are similar and will not be repeated here. This device may include, but is not limited to, mobile terminals such as smartphones, laptops, tablets (PADs), portable multimedia players (PMPs), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed electronic devices such as digital TVs and desktop computers.
[0235] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure, such as... Figure 5 As shown, the electronic device 500 may include a processor 510 and a memory 520. The memory 520 stores a computer program 521. When the computer program 521 is executed by the processor 510, it can implement the method provided in any of the above embodiments. The execution mode and beneficial effects are similar and will not be described again here.
[0236] Of course, for the sake of simplicity, Figure 5 Only some of the components of the electronic device 500 relevant to the present invention are shown, omitting components such as buses, input / output interfaces, input devices, and output devices. In addition, the electronic device 500 may include any other suitable components depending on the specific application.
[0237] This disclosure provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement the methods of any of the above embodiments. The execution method and beneficial effects are similar, and will not be described again here.
[0238] The aforementioned computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0239] The computer program described above can be written in any combination of one or more programming languages to perform the operations of the embodiments of this disclosure. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer device, partially on the user's device, as a standalone software package, partially on the user's computer device and partially on a remote computer device, or entirely on a remote computer device or server.
[0240] This disclosure provides a vehicle that includes the aforementioned intelligent headlight switching device, which can implement the methods of any of the above embodiments. The execution method and beneficial effects are similar, and will not be repeated here.
[0241] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for intelligent light switching, characterized in that, include: Acquire the current frame image in the vehicle's direction of travel; The first target light source contained in the previous frame of the current frame image is determined as the first tracking light source; The current frame image is subjected to light source identification to obtain the target light source contained in the current frame image, and the target light source contained in the current frame image is determined as the second target light source; The second target light source contained in the current frame image is matched with the first tracked light source to obtain a matching result; Based on the matching results, determine whether it is necessary to switch between high and low beam headlights; The step of determining whether to switch between high and low beam headlights based on the matching result includes: Obtain a second preset number of frames after the current frame image; For each frame in the second preset number of frames, determine the matching result between the target light source contained in the image and the first tracking light source; If the second target light source in the current frame image matches the first tracking light source, then count the first number of image frames corresponding to the result of the target light source matching the first tracking light source in each of the second preset number of frame images; If the first quantity is greater than the preset threshold, it is determined that the second target light source matches the first tracking light source, and there is no need to switch between high and low beams. If the second target light source in the current frame image does not match the first tracking light source, then count the second number of image frames corresponding to the result that the target light source does not match the first tracking light source in each of the second preset number of frame images; If the second quantity is greater than a preset threshold, it is determined that the second target light source and the first tracking light source do not match. A corresponding Kalman filter is constructed for the second target light source, and the second target light source and the first tracking light source are determined as the third tracking light source. Based on the type of the third tracking light source and the vehicle's lighting status, the vehicle is controlled to switch between high and low beam headlights.
2. The method according to claim 1, characterized in that, The step of determining the first target light source contained in the previous frame image of the current frame image as the first tracking light source includes: The light source detection network is used to detect the light source in the previous frame image to obtain the light source contained in the previous frame image; The light sources are classified based on a light source classification network to determine the first target light source among them; The first target light source is designated as the first tracking light source.
3. The method according to claim 1, characterized in that, The step of matching the second target light source with the first tracking light source to obtain a matching result includes: Based on the Kalman filter corresponding to the first tracking light source, the position of the first tracking light source in the current frame image is predicted to obtain the predicted position of the first tracking light source; Perform light source identification on the current frame image to obtain the actual position of the second target light source in the current frame image; Based on the actual position of the second target light source and the predicted position of the first tracking light source, a Hungarian matching is performed to obtain the matching result.
4. The method according to claim 3, characterized in that, The step of predicting the position of the first tracking light source in the current frame image based on the Kalman filter corresponding to the first tracking light source, to obtain the predicted position of the first tracking light source, includes: Based on the Kalman filter corresponding to the first tracking light source, predict the trajectory of the first tracking light source from the previous frame image to the current frame image; Based on the trajectory, the position of the first tracking light source in the current frame image is determined; The position of the first tracking light source in the current frame image is determined as the predicted position of the first tracking light source.
5. The method according to claim 3, characterized in that, The step of performing Hungarian matching based on the actual position of the second target light source in the current frame image and the predicted position of the first tracked light source to obtain the matching result includes: Calculate the intersection-union ratio (IU) between the actual bounding box region corresponding to the actual location and the predicted bounding box region corresponding to the predicted location; Based on the intersection-union ratio corresponding to the second target light source, a similarity matrix between the second target light source and the first tracking light source contained in the current frame image is constructed. Based on the similarity matrix, Hungarian matching is performed to obtain the matching results.
6. The method according to claim 1, characterized in that, The matching results include the second target light source matching the first tracking light source and the second target light source not matching the first tracking light source; The step of determining whether to switch between high and low beam headlights based on the matching result includes: If the second target light source matches the first tracking light source, then it is determined that the second target light source and the first tracking light source are the same, and there is no need to switch between high and low beams. If the second target light source does not match the first tracking light source, then the second target light source is determined to be different from the first tracking light source. A corresponding Kalman filter is constructed for the second target light source, and the second target light source and the first tracking light source are determined as the tracking light sources in the current frame image. The tracking light source in the current frame image is then determined as the second tracking light source. Based on the type of the second tracking light source and the vehicle's lighting status, the vehicle is controlled to switch between high and low beam headlights.
7. The method according to claim 6, characterized in that, If the second target light source matches the first tracking light source, and after determining that the second target light source and the first tracking light source are the same, the method further includes: Update the Kalman filter corresponding to the first tracking light source, determine the first tracking light source as the tracking light source in the current frame image, and determine the tracking light source in the current frame image as the second tracking light source.
8. The method according to claim 6, characterized in that, If the second target light source does not match the first tracking light source, then the method further includes determining that the second target light source is different from the first tracking light source, constructing a corresponding Kalman filter for the second target light source, determining the second target light source and the first tracking light source as tracking light sources in the current frame image, and determining the tracking light source in the current frame image as the second tracking light source. Obtain the first preset number of frames after the current frame image; For each frame in the first preset number of frames, determine the matching result between the target light source contained in the image and the second tracking light source; If the second tracking light source does not match the target light source contained in each frame of the first preset number of frames, then the second tracking light source and the Kalman filter corresponding to the second tracking light source are removed.
9. The method according to claim 6, characterized in that, The step of controlling the vehicle to switch between high and low beam headlights based on the type of the second tracking light source and the vehicle's lighting status includes: Determine whether the second tracking light source contains a first type of light source and the vehicle's lighting status; If the second tracking light source contains a first-category light source and the vehicle's headlights are not in low beam mode, then control the vehicle to switch to low beam mode. If the first type of light source is not present in the second tracking light source, then it is determined whether the second type of light source is present in the second tracking light source and whether the distance between the second type of light source and the vehicle is less than or equal to a preset distance threshold. If there is a second type of light source in the second tracking light source and the distance between the second type of light source and the vehicle is less than or equal to a preset distance threshold and the vehicle's headlights are not in low beam mode, then control the vehicle to switch to low beam mode. If there is no second type of light source in the second tracking light source or the distance between the second type of light source and the vehicle is greater than a preset distance threshold, then it is determined whether there is a third type of light source in the second tracking light source and whether the brightness state of the third type of light source belongs to a preset brightness state. If there is a third type of light source in the second tracking light source and the brightness state of the third type of light source is a preset brightness state and the vehicle's headlights are not in the low beam state, then control the vehicle to switch to low beam. If there is no third type of light source in the second tracking light source and the vehicle's headlights are not in the high beam mode, or if the brightness of the third type of light source is not in the preset brightness mode and the vehicle's headlights are not in the high beam mode, then control the vehicle to switch to high beam mode.
10. An intelligent lighting switching device, characterized in that, include: The acquisition module is used to acquire the current frame image in the vehicle's driving direction; The first determining module is used to determine the first target light source contained in the previous frame image of the current frame image as the first tracking light source; The identification module is used to identify the light source in the current frame image, obtain the target light source contained in the current frame image, and determine the target light source contained in the current frame image as the second target light source; The matching module is used to match the second target light source contained in the current frame image with the first tracked light source to obtain a matching result; The second determining module is used to determine whether it is necessary to switch between high and low beam headlights based on the matching result; The second determining module includes: The first acquisition submodule is used to acquire a second preset number of frame images following the current frame image; The fifth determining submodule is used to determine the matching result between the target light source contained in each frame of the second preset number of frame images and the first tracking light source; The first statistics submodule is used to count the first number of image frames corresponding to the result of the target light source matching the first tracking light source in each of the second preset number of frame images if the second target light source in the current frame image matches the first tracking light source. The sixth determining submodule determines that if the first quantity is greater than a preset threshold, the second target light source is matched with the first tracking light source, and there is no need to switch between high and low beams. The second statistics submodule is used to count the second number of image frames corresponding to the result that the target light source in the current frame image does not match the first tracking light source if the second target light source in the current frame image does not match the first tracking light source. The seventh determination submodule is used to determine that the second target light source and the first tracking light source do not match if the second quantity is greater than a preset threshold, construct a corresponding Kalman filter for the second target light source, and determine the second target light source and the first tracking light source as the third tracking light source; The second control submodule is used to control the vehicle to switch between high and low beam headlights based on the type of the third tracking light source and the vehicle's lighting status.
11. An electronic device, characterized in that, include: A memory and a processor, wherein the memory stores a computer program that, when executed by the processor, implements the intelligent light switching method as described in any one of claims 1-9.
12. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the intelligent light switching method as described in any one of claims 1-9.
13. A vehicle, characterized in that, The vehicle includes the intelligent headlight switching device as described in claim 10.
Citation Information
Patent Citations
Vehicle headlamp state control method and device
CN106915295A
Intelligent light switching method and system and related equipment
CN114454809A
Method for detecting traffic lights and electronic equipment
CN114529883A