A lighting compensation method, device and equipment for intelligent vehicle lights
By detecting the brightness, tunnel entrance and exit and vehicle targets of the video data ahead of the journey, and generating light control instructions, the problem that the existing vehicle lighting system cannot intelligently adjust the brightness of the vehicle lights is solved, and the intelligent control of the vehicle lighting system is realized, which improves the Driving safety and operational ease.
Patent Information
- Application Number
- CN202410372366.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-29
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-03-29
AI Technical Summary
The existing vehicle lighting system cannot intelligently adjust the brightness of the headlights according to the real-time environmental brightness and road conditions, resulting in limited driving safety, especially in tunnel entrances, foggy or rainy days, which may lead to traffic accidents.
By obtaining the video data ahead of the journey, brightness, tunnel entrance and exit and vehicle target detection are carried out, light control instructions are generated, high and low beam switching and brightness adjustment of the headlights are realized, reducing the driver's operation complexity and improving driving safety.
It realizes intelligent control of the vehicle lighting system, and refines the lights according to brightness and road conditions, reducing the driver's operation complexity, improving driving safety, and relying solely on camera video data, the equipment cost is lower.
Smart Images

Figure CN118386985B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automobile lighting control, and in particular to a lighting compensation method, device and equipment for intelligent automobile lights. Background Art
[0002] The rapid development of modern transportation has made driving safety a focus of social attention. The lighting system of a vehicle is crucial to driving safety. It plays a key role in many aspects to ensure driving safety at night and in bad weather conditions. The existing lighting system of a vehicle has certain limitations in adapting to changes in ambient brightness. Although some vehicles are equipped with intelligent photosensitive devices that can automatically turn on or adjust the brightness of the lights when the ambient brightness decreases, the response of these devices is usually based on a preset threshold rather than real-time changes in ambient brightness. This means that in some cases, the lights may not be adjusted to the most appropriate brightness in time, such as at the entrance or exit of a tunnel, or when entering a shadow area from a bright street. In addition, when driving in foggy weather, fog lights and low beams should be turned on, but high beams should never be turned on, because the light emitted by the high beam will be diffusely reflected by the fog, forming a white area in front of the car, which will affect the driver's vision; on rainy days, the beam angle may need to be adjusted to avoid glare on the road surface. The above operations in the existing technology often rely on the driver's experience and often cause traffic safety accidents due to improper operation. Summary of the invention
[0003] In view of this, the present application provides a lighting compensation method for intelligent vehicle lights to solve the technical problem that the prior art vehicle lights cannot be intelligently adjusted according to brightness, road conditions, and vehicle targets.
[0004] According to a first aspect of the present application, a lighting compensation method for an intelligent vehicle lamp is provided, comprising:
[0005] Get the video data ahead of you;
[0006] Performing brightness detection on the video data to obtain a brightness detection result;
[0007] Performing tunnel entrance and exit detection on the video data to obtain a tunnel entrance and exit detection result;
[0008] Performing vehicle target detection on the video data to obtain a vehicle target detection result;
[0009] Based on the brightness detection result, the tunnel entrance and exit detection result and the vehicle target detection result, a light control instruction is generated, wherein the light control instruction is a control strategy for high and low beam switching and brightness of the vehicle light.
[0010] According to a second aspect of the present application, a lighting compensation device for an intelligent vehicle lamp is provided, comprising:
[0011] An acquisition module is used to acquire the video data ahead of the vehicle;
[0012] A first detection module, used for performing brightness detection on the video data to obtain a brightness detection result;
[0013] A second detection module is used to perform tunnel entrance and exit detection on the video data to obtain a tunnel entrance and exit detection result;
[0014] A third detection module is used to perform vehicle target detection on the video data to obtain a vehicle target detection result;
[0015] A control module is used to generate a lighting control instruction based on the brightness detection result, the tunnel entrance and exit detection result and the vehicle target detection result, wherein the lighting control instruction is a control strategy for switching between high and low beams and brightness of the vehicle lights.
[0016] According to a third aspect of the present application, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned lighting compensation method for intelligent vehicle lights when executing the computer program.
[0017] According to a fourth aspect of the present application, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the steps of the lighting compensation method of the above-mentioned smart vehicle lamp are implemented.
[0018] By means of the above technical scheme, the present application provides a lighting compensation method, device, equipment and medium for intelligent headlights, which obtains the video data ahead; performs brightness detection on the video data to obtain the brightness detection result; performs tunnel entrance and exit detection on the video data to obtain the tunnel entrance and exit detection result; performs vehicle target detection on the video data to obtain the vehicle target detection result; and generates a lighting control instruction based on the brightness detection result, the tunnel entrance and exit detection result and the vehicle target detection result. The intelligent control of the headlights of the vehicle during driving is realized, and the fine adjustment can be made according to the brightness, road conditions and vehicle targets respectively, which reduces the complexity of the driver's control over the operation of the headlights and effectively improves driving safety. Moreover, the detection only requires the video data of the camera, which is convenient to implement and has low equipment cost.
[0019] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application and to implement it in accordance with the contents of the specification, and to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0021] Figure 1 A schematic diagram showing an application scenario of a lighting compensation method for a smart vehicle lamp provided in an embodiment of the present application is shown;
[0022] Figure 2 A flow chart of a lighting compensation method for a smart vehicle lamp provided in the first embodiment of the present application is shown;
[0023] Figure 3 A network schematic diagram of a vehicle target detection model provided in Embodiment 2 of the present application is shown;
[0024] Figure 4 A schematic structural diagram of a lighting compensation device for an intelligent vehicle lamp provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0025] The specific implementation of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0026] An intelligent vehicle lamp lighting compensation method provided by an embodiment of the present invention can be applied to Figure 1 The hardware system can be installed in a variety of vehicles, such as electric bicycles, motorcycles, motor vehicles, etc. Taking the Advanced Driver Assistance System (ADAS) as an example, the various components work together to ensure the overall performance and safety of the system. In order to simplify the complexity of the system, combined Figure 1 The simplified hardware system is explained below. The controller is the brain of the ADAS system and is responsible for processing data from cameras and other sensors. It runs complex algorithms to identify and analyze road conditions, traffic conditions, and other relevant information. The main controller can share a processor with the vehicle's processor or set up a separate processor that is connected to at least one camera installed on the vehicle. The LED driver is used to control the brightness and color of the vehicle's LED lights. The AFS controller is responsible for managing the vehicle's headlight system, including the intensity, direction, and range of the light. It can automatically adjust the light according to the vehicle's speed, steering angle, and road conditions. The controlled lights can include headlights, clearance lights, and taillights. In addition, there may be fog lights, turn signals, brake lights, taillights, license plate lights, etc.
[0027] For motor vehicles, it can be reused with the existing ADAS system. For electric bicycles and motorcycles, since there is no ready-made ADAS system, Open MV can be used as a camera processing module (or ESP32CAM module) for low-cost applications. With a microprocessor as the core (which can be shared with the advanced driver assistance system ADAS integrated on the vehicle), the camera chip is integrated, and the core machine vision algorithm is efficiently implemented in C language or Go language. It is equipped with a MicroPython interpreter and programmed in Python. The communication between the control module and the OpenMV module is realized by IC bus serial port communication. For the working mode of the high and low beam switching circuit, the automatic / manual conversion switch allows the driver to choose the automatic or manual mode. In the case of failure of the automatic dimming mode, this switch can still realize manual dimming. In the automatic dimming mode, the lighting compensation method of the intelligent headlight provided by the embodiment of the present invention is implemented by acquiring the video data ahead of the vehicle; performing brightness detection on the video data to obtain the brightness detection result; performing tunnel entrance and exit detection on the video data to obtain the tunnel entrance and exit detection result; performing vehicle target detection on the video data to obtain the vehicle target detection result; and generating a light control instruction based on the brightness detection result, the tunnel entrance and exit detection result and the vehicle target detection result. The intelligent control of the headlights of the vehicle during driving is realized, and the fine adjustment can be made according to the brightness, road conditions and vehicle targets respectively, which reduces the complexity of the driver's control of the headlight operation and control, effectively improves the driving safety, and the detection only requires the camera video data, which is convenient to implement and has low equipment cost. For example, when the high beam is turned on, the single-chip microcomputer analyzes the signal collected by the sensor. If there is a phenomenon of meeting or following a car or the road has good illumination, the headlight is automatically switched from the high beam to the low beam through control, and the brightness of the headlight is controlled according to the ambient brightness. Automatic switching is achieved through the relay, and the relay is controlled to be powered on and off according to the low beam and high beam road conditions judged by the visual module to complete the switching work.
[0028] The present invention is described in detail below through specific embodiments.
[0029] Embodiment 1
[0030] like Figure 2 As shown, a lighting compensation method of a smart vehicle lamp provided in an embodiment of the present invention includes:
[0031] Step 201, obtaining the video data ahead;
[0032] The `cv2.VideoCapture()` function in the OpenCV library is used to read the camera video stream. `cap.read()` is used in the loop to read the video frame by frame, and the return values are `ret` (Boolean value, indicating whether the reading is successful or not) and `frame` (the frame image read).
[0033] Step 202: Perform brightness detection on the video data to obtain a brightness detection result;
[0034] Step 203: Perform tunnel entrance and exit detection on the video data to obtain tunnel entrance and exit detection results;
[0035] Step 204: Perform vehicle target detection on the video data to obtain a vehicle target detection result;
[0036] Step 205: Generate a lighting control instruction based on the brightness detection result, the tunnel entrance and exit detection result, and the vehicle target detection result.
[0037] Among them, the lighting control instruction is the control strategy of the high and low beam switching and brightness of the headlights. For example, based on the brightness detection result, when the brightness is too dark, turn on the low beam; based on the tunnel entrance and exit detection result, when it is detected that you enter the tunnel and the external light intensity is lower than the preset threshold, turn on the high beam automatically; when it is detected that you are about to leave the tunnel and the external light intensity is higher than the preset threshold, automatically switch to the low beam. Based on the vehicle target detection result, when it is judged that there is an oncoming car ahead, the high beam is gradually adjusted to the low beam.
[0038] When driving a vehicle, according to traffic regulations, it is necessary to turn on the front lights when driving in tunnels. Manual control of the turning on of the lights often lags behind or is forgotten, which leads to various accidents. In the prior art, when a vehicle enters a tunnel, due to the low brightness in the tunnel, a photosensitive device is installed at the front end of the vehicle. As the vehicle enters the tunnel, the brightness further decreases before the photosensitive device is triggered to automatically adjust the brightness of the vehicle lighting device. Generally, the lights need to be turned on or switched when the lighting brightness changes upon entering the tunnel. This time point is prone to accidents. The present invention can effectively avoid this problem by identifying the tunnel contour and making adjustments in advance before entering and exiting the tunnel.
[0039] In actual applications, the strategy of light control instructions can be flexibly adjusted. For example, when the lights are on in the tunnel, during the day, after entering the tunnel, the light suddenly changes from bright to dark, and the driver's vision is not yet adapted. You can control the high beam to be turned on for a while, so that the eyes can adapt, and then switch the light to the low beam. At night, since the lights are on in the tunnel, the low beam can be kept unchanged before entering the tunnel. When exiting the tunnel, you can control the high beam to be turned on for a few seconds to allow the driver's vision to adapt to the lights. When the lights are off in the tunnel, if it is daytime, the high beam should be turned on for a while before entering the tunnel, so that the driver's vision can adapt to the light from bright to dark. If there is no car in front, the high beam can be turned on until the light is turned off after exiting the tunnel. If it is at night, turn on the high beam before entering the tunnel, and then use the high and low beams alternately depending on whether there is a car in front.
[0040] The lighting compensation method of the intelligent headlight provided in the first embodiment of the present invention is to obtain the video data ahead of the vehicle; perform brightness detection on the video data to obtain the brightness detection result; perform tunnel entrance and exit detection on the video data to obtain the tunnel entrance and exit detection result; perform vehicle target detection on the video data to obtain the vehicle target detection result; generate the lighting control instruction based on the brightness detection result, the tunnel entrance and exit detection result and the vehicle target detection result. It should be specially noted here that, especially considering two-wheeled vehicles such as electric bicycles and motorcycles, the tunnel referred to in the embodiment of the present invention is only one of the application scenarios. In actual applications, it can also be urban lanes, underground passages, underbridge passages, etc. Considering that these passages have similar entrance features to tunnels, the detection methods are similar and will not be repeated here. The intelligent control of the headlights of the vehicle during driving is realized, and the fine adjustment can be made according to the brightness, road conditions and vehicle targets respectively, which reduces the complexity of the driver's control over the operation of the headlights and effectively improves driving safety. Moreover, the detection only requires the video data of the camera, which is convenient to implement and has low equipment cost.
[0041] Embodiment 2
[0042] In step 202, the video data is subjected to brightness detection to obtain a brightness detection result, mainly for the brightness of the road surface. The detection steps include:
[0043] Step 202-1, obtaining at least one video screenshot;
[0044] Step 202-2: Convert the video screenshot into a grayscale image and obtain the grayscale value of each pixel Among them, i and j are pixel coordinates, P h is the pixel grayscale;
[0045] Step 202-3: According to the gray value of each pixel Calculate the average pixel offset Among them, P s h is the reference grayscale value, and N is the number of pixels of the video screenshot;
[0046] Step 202-4: Calculate the grayscale average deviation based on the grayscale histogram of the video screenshot Among them, i is the gray level, and the gray level cell ranges from 0 to 255, with a total of 256 gray levels;
[0047] Step 202-5: Calculate brightness coefficient When the brightness coefficient is greater than 1 and Hist bias When the brightness coefficient is greater than 0, the brightness is normal; when the brightness coefficient is greater than 1 and Hist bias When it is less than 0, the brightness is too dark; when the brightness coefficient is less than 1, the brightness of the video data is normal.
[0048] The algorithm of the second embodiment of the present invention can automatically analyze the brightness distribution of an image and provide a brightness evaluation method that does not require human intervention. By calculating the brightness coefficient (k), the algorithm quantifies the brightness deviation into a specific numerical value, which is easy to understand and compare. The algorithm uses efficient numerical calculation and image processing technology to quickly perform brightness analysis on the image and is suitable for real-time or batch processing.
[0049] In order to reduce the interference of other brightness areas in the video data on brightness detection, the brightness detection is concentrated on the road area to reduce the computational complexity. Before step 202-1, the automatic selection of the ROI (region of interest) area is realized, that is, the road area is automatically selected, including:
[0050] Step 202-11, determining the height of the region of interest ROI based on the vanishing point detection algorithm of the gLoG filter;
[0051] The height of the ROI is determined by a vanishing point detection algorithm based on the gLoG (Laplacian of Gaussian) filter. The gLoG scale space image is generated and then the gLoG filter is applied to detect the vanishing point in the image. The vanishing point is the point where all lane lines in the image converge, usually located far away on the road.
[0052] Step 202-12: dynamically adjust the width of the ROI according to the lane line position in the current video frame being close to the lane line position in the previous video frame;
[0053] Among them, dynamically adjust the ROI width: use the continuity of the image, that is, the lane line position in the current frame is close to the lane line position in the previous frame, and dynamically adjust the ROI width. The vertical coordinate of the fitted lane line in the previous frame is used as the vertical coordinate of the ROI, and the horizontal coordinate of the lane line synthesis area in the previous frame is used as the horizontal coordinate of the ROI. By processing in this way, the ROI only contains the lane line area, reducing the interference of the non-lane line area.
[0054] Step 202-13: determine the screenshot range according to the height and width of the ROI.
[0055] Among them, brightness detection is performed on a determined screenshot range, which reduces processing complexity and improves the accuracy of brightness detection.
[0056] In addition, in the second embodiment of the present invention, the automatic ROI selection can also be realized through deep learning, and the image segmentation technology is used for implementation, for example, a deep learning model (such as U-Net, SegNet, etc.) is used to identify the road surface area in the image. Once the road surface is detected, the road surface is segmented, and the specific area of the road surface is extracted through edge detection, contour extraction or semantic segmentation network in deep learning.
[0057] Embodiment 3
[0058] The step of performing tunnel entrance and exit detection on the video data in step 203 to obtain the tunnel entrance and exit detection result specifically includes:
[0059] Step 203-1, obtaining at least one video screenshot;
[0060] Step 203-2, performing mean shift filtering on the video screenshot to generate a first screenshot image;
[0061] Among them, the filtered color image is converted to a grayscale image, using the `cv2.cvtColor()` function, and selecting `cv2.COLOR_BGR2GRAY` as the conversion type. The grayscale image is the prerequisite for binarization and edge detection.
[0062] Step 203-3: convert the video screenshot after the mean shift filtering process into a grayscale image and perform binarization process to generate a first detection picture;
[0063] The grayscale image is binarized using the cv2.threshold() function. A suitable threshold (such as 25) is set to distinguish the foreground from the background. The binarized first detection image will help highlight the outline of the tunnel.
[0064] Step 203-4: performing edge detection on the first detection image to generate a second detection image;
[0065] Among them, the Sobel operator is used for edge detection. The Sobel operator is a discrete differential operator used for edge detection, which can highlight the high-frequency area (edge) in the image. Set the convolution kernel size (such as 5x5) and calculate the gradient in the x and y directions respectively. Perform a truncation transformation on the gradient result to ensure that the value is in the range of 0-255. The gradient results in the x and y directions are weighted and synthesized to obtain the final edge image.
[0066] Step 203-5: Perform Hough circle detection on the second detection image to obtain a tunnel entrance and exit contour detection result.
[0067] Among them, the `cv2.HoughCircles()` function is used for Hough circle detection. This function returns an array containing the coordinates of the center of the circle and the radius. Set the resolution of the Hough space (such as 1 pixel), the minimum distance of the center of the circle (such as 2000 pixels), and the accumulator threshold for detecting circles (such as 20). The minimum circle radius is set to 50 pixels to filter out small noise points. Among the detected circles, the circle that passes through the most points is selected as a candidate for the tunnel.
[0068] In practical applications, the detected circles need to be post-processed, such as checking whether the center of the circle is within the region of interest (ROI). The calculation of the black area ratio can be achieved by calculating the proportion of black pixels in the binary image. This can be done by traversing the binary image and counting black pixels (value 0). In order to improve computational efficiency, you can consider using a step size to calculate the black area ratio instead of calculating it pixel by pixel. The purpose of the whole process is to automatically identify the entrance of the high-speed tunnel from the image captured by the camera.
[0069] Step 203-4 may perform edge detection on the first detection image according to the firefly algorithm to generate a second detection image. In the third embodiment of the present invention, the firefly algorithm is optimized to achieve a better edge detection optimization effect, specifically including:
[0070] Step 203-41, selecting N pixels in the first detection image as N fireflies, and randomly dividing the N fireflies into M groups, where N and M are natural numbers greater than 1;
[0071] Among them, the size of the image (number of pixels) is a factor that affects the number of fireflies. Generally speaking, larger images require more fireflies to cover and search the entire solution space. The ratio of the number of fireflies to the number of image pixels can be set, for example, one firefly is used for every 100 pixels or pixels are randomly selected as fireflies. In addition, in order to avoid fireflies gathering in a certain noise area in the image, causing the noise to be mistakenly detected as an edge, in this step, the fireflies are randomly divided into multiple groups, and the fireflies in each group move closer to the brightest firefly in the group, while increasing the randomness of the firefly movement to improve the algorithm's search ability.
[0072] Step 203-42: Calculate the brightness of each group of fireflies The brightness L(x,y) of the firefly is determined based on the brightness threshold ST. Among them, x, y are pixel coordinates, H x,y is the grayscale of the pixel with coordinates x, y, L(x,y) max is the maximum brightness of the fireflies in the kth group of fireflies;
[0073] Each pixel is considered as a possible location for a firefly to stay, and the brightness of the firefly is related to its location. The grayscale value of pixels in the edge area varies greatly, so they have higher brightness. This relationship between brightness and position helps the algorithm identify edges more accurately. An edge threshold ST is defined. Only when the grayscale value of a pixel is higher than this threshold, it is considered to have a high edge probability. This can effectively detect the edges in the image, while reducing the sensitivity to noise and improving the accuracy and robustness of edge detection.
[0074] Step 203-43, update the position x' of each firefly according to the attraction calculation i,k =x i,k +β(r)(x j,k -x i,k )+α*rand;
[0075] Among them, x′ i,k is the updated firefly position, x i,k is the position of the fireflies before the update, β(r) is the attraction between fireflies, is the position of the brightest firefly j in the group, α is the step size perturbation factor, Rand is a number randomly drawn from the (0,1) standard normal distribution, and the attraction between fireflies is Among them, μ is the absorption coefficient used to control the attenuation of attraction with distance, r is the distance between two fireflies, and β0 is the maximum attraction value, which can be defined as is the mean brightness of the pixel grid or group of fireflies, L(x1,y1) is the brightness of the firefly at the current position, and L(x2,y2) is the brightness of the firefly at the target position. In order to further increase the global search capability, x i,k A random perturbation x can be added to i,k =x k,max Rand(),x k,max represents the maximum value of the coordinates of k groups of fireflies, and Rand is a number randomly drawn from the (0,1) standard normal distribution.
[0076] Step 203-44, updating the brightness of each firefly according to the updated position of each firefly;
[0077] Step 203-45, determine whether the number of iterations is greater than the preset number of iterations and whether the difference between the extreme values of firefly brightness in two adjacent iterations is less than the preset threshold. When the preset number of iterations is reached or the difference between the extreme values of firefly brightness in two adjacent iterations is less than the preset threshold, the position combination corresponding to the current extreme value of firefly brightness is used as the edge detection result; when the number of iterations is not reached or the difference between the extreme values of firefly brightness in two adjacent iterations is greater than the preset threshold, update the position of each firefly and continue execution.
[0078] Although the traditional firefly algorithm has a strong local search capability and a fast convergence speed, it is also easy to fall into a local optimal solution. In order to meet the needs of edge detection, the optimized firefly algorithm in the third embodiment of the present invention is compared to make it better adapt to the edge detection task. The relationship between brightness and position, each pixel is regarded as a possible location for a firefly to stay, and the brightness of a firefly is related to its position. The pixel grayscale value in the edge area varies greatly, so it has a higher brightness. This relationship between brightness and position helps the algorithm to identify edges more accurately. In order to prevent fireflies from converging directly to the brightest position, thereby ignoring other positions with a higher edge probability, an embodiment of the present invention proposes a method for updating the brightness formula. By setting an edge threshold (ST), only when the pixel grayscale value is higher than the threshold, it is regarded as a position with a higher edge probability. In the improved algorithm, there is an attraction between fireflies, and this attraction will affect the position of the fireflies. By adjusting the attraction formula, the fireflies not only move closer to the brightest fireflies, but also maintain randomness to a certain extent, avoiding falling into a local optimal solution. In order to prevent fireflies from gathering in a certain noise area in the image, causing the noise to be mistakenly detected as an edge, an embodiment of the present invention proposes an improved position update strategy.
[0079] Embodiment 4
[0080] Step 204, in which the video data is subjected to vehicle target detection to obtain a vehicle target detection result, comprises:
[0081] Step 204-1, loading a vehicle target detection model;
[0082] Step 204 - 2 : Detect vehicle targets on the video data using the vehicle target detection model to obtain a vehicle target detection result.
[0083] Among them, the yolo network belongs to the prior art, and the specific network details are not repeated here. The fourth embodiment of the present invention improves the existing yolo network, such as Figure 4The improved YOLO network (YOLO network can include multiple versions such as V4 or V5) structure is shown. The backbone network backbone part includes a focus structure, a CSP structure, and a SPP structure. The neck network (feature fusion network) structure is a PAN structure, and the head network structure is a three-branch structure. In the fourth embodiment of the present invention, the backbone network is replaced by MobileNet, and the LRCA-Net (Lightweight Residual Convolutional Attention Network) module is added to the head layer network output (between the head layer network output and the feature fusion network layer). The LRCA-Net module includes a global average pooling (Global Average Pooling) and a global maximum pooling (Global Max Pooling) layer, followed by a channel attention module (Channel Attention) and a spatial attention module (Spatial Attention). The channel attention module replaces the fully connected layer with a 1D convolutional layer to calculate the channel attention weight of the feature map. Then, the feature map after channel attention is obtained by the activation function (Sigmoid) and multiplication operation. The spatial attention module obtains the final feature map by performing spatial attention calculation on the feature map. The structural design of the LRCA-Net module aims to improve the accuracy of the network and combines the characteristics of channel attention and spatial attention to achieve adaptive learning features.
[0084] Embodiment 4 of the present invention proposes a lightweight residual convolutional attention network (LRCA-Net), which combines an attention mechanism to enable the network to focus on the required detailed features and suppress the interference of other useless information, thereby improving accuracy. Secondly, by replacing the YOLOv4 backbone network with a lightweight network MobileNet and using a deep separable convolutional layer in the feature fusion network, combined with the network attention mechanism, the network is made more efficient and the number of parameters is greatly reduced. A vehicle semantic segmentation network based on a lightweight network MobileNet is proposed, which further enhances the feature representation by inserting an attention mechanism, effectively utilizes the data set and improves the segmentation accuracy of the network, thereby improving the recognition of vehicle targets.
[0085] After the vehicle is identified by the algorithm of the fourth embodiment of the present invention, the distance is measured. After calculating the position information of the target vehicle, it is determined whether the current distance meets the light switching requirements. In addition, by continuously obtaining images for identification, it is determined whether the vehicle is an oncoming vehicle or a same-direction vehicle. If the conditions are met, a signal is transmitted to the circuit control to switch the circuit and adjust the high and low beam lights to avoid glare on the oncoming vehicle.
[0086] It should be noted that another factor that needs to be considered during driving includes the many glare effects generated by the environment, such as the glare generated by the road surface on rainy days, which requires color optimization of optical properties, considering the optical properties of wet and slippery roads and water accumulation, and optimizing the color adjustment strategy of the headlights. For example, when driving on a flooded road, choose a light source that emits warm tones, such as orange or yellow, because these colors can better penetrate rainwater, reduce reflections and glare, and warmer colors help increase the visibility of light reflected from the road surface; when the road surface is monitored to be highly wet, there may be a lot of water or a large area of water accumulation. In this case, a cooler color temperature can be used, such as white or slightly blue. Cooler colors help increase the brightness and clarity of the road surface and enhance the driver's perception of road conditions.
[0087] Further, as Figure 2 In the specific implementation of the method, an embodiment of the present invention provides a lighting compensation device for an intelligent vehicle lamp, such as Figure 4 As shown, the device comprises:
[0088] An acquisition module 410 is used to acquire the video data ahead of the vehicle;
[0089] A first detection module 420, configured to perform brightness detection on the video data to obtain a brightness detection result;
[0090] The second detection module 430 is used to perform tunnel entrance and exit detection on the video data to obtain the tunnel entrance and exit detection result;
[0091] The third detection module 440 is used to perform vehicle target detection on the video data to obtain a vehicle target detection result;
[0092] The control module 450 is used to generate a light control instruction based on the brightness detection result, the tunnel entrance and exit detection result and the vehicle target detection result, wherein the light control instruction is a control strategy for switching between high and low beams and brightness of the vehicle lights.
[0093] In an embodiment of the present invention, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of implementing the lighting compensation method of the intelligent vehicle lamp include:
[0094] Performing brightness detection on the video data to obtain a brightness detection result;
[0095] Perform tunnel entrance and exit detection on the video data to obtain the tunnel entrance and exit detection results;
[0096] Perform vehicle target detection on the video data to obtain a vehicle target detection result;
[0097] Based on the brightness detection results, tunnel entrance and exit detection results and vehicle target detection results, a lighting control instruction is generated, wherein the lighting control instruction is a control strategy for switching between high and low beams and brightness of the vehicle lights.
[0098] In an embodiment of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0099] Get the video data ahead of you;
[0100] Performing brightness detection on the video data to obtain a brightness detection result;
[0101] Perform tunnel entrance and exit detection on the video data to obtain the tunnel entrance and exit detection results;
[0102] Perform vehicle target detection on the video data to obtain a vehicle target detection result;
[0103] Based on the brightness detection results, tunnel entrance and exit detection results and vehicle target detection results, a lighting control instruction is generated, wherein the lighting control instruction is a control strategy for switching between high and low beams and brightness of the vehicle lights.
[0104] It should be noted that the above embodiments only use electric bicycles to illustrate the principles and implementation steps of the embodiments of the present invention, and no specific limitation is made to the actual means of transportation. For example, the technical solution of the present invention can also be applied to electric bicycles, motorcycles, cars, etc. For the functions or steps that can be implemented by computer-readable storage media or computer devices, please refer to the aforementioned method embodiments. To avoid repetition, they will not be described one by one here.
[0105] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0106] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0107] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A lighting compensation method for intelligent vehicle lights, characterized in that: include: Get the video data ahead of you; Performing brightness detection on the video data to obtain brightness detection results, specifically including: determining the height of the region of interest (ROI) based on a vanishing point detection algorithm based on a gLoG filter; dynamically adjusting the width of the ROI according to the lane line position in the current video frame being close to the lane line position in the previous video frame; determining a screenshot range according to the height of the ROI and the width of the ROI; obtaining at least one video screenshot; converting the video screenshot into a grayscale image, and obtaining the grayscale value of each pixel Among them, i and j are pixel coordinates, P h is the pixel grayscale; according to the grayscale value of each pixel Calculate the average pixel offset in, is the reference grayscale value, N is the number of pixels of the video screenshot; according to the grayscale histogram of the video screenshot, the grayscale average deviation is calculated Among them, i is the gray level, and the gray level cell ranges from 0 to 255, a total of 256 gray levels; calculate the brightness coefficient When the brightness coefficient is greater than 1 and Hist bias When the brightness coefficient is greater than 0, the brightness is normal; when the brightness coefficient is greater than 1 and Hist bias When it is less than 0, the brightness is too dark; when the brightness coefficient is less than 1, the brightness of the video data is normal; Performing tunnel entrance and exit detection on the video data to obtain the tunnel entrance and exit detection result, specifically including: obtaining at least one video screenshot; performing mean shift filtering on the video screenshot to generate a first screenshot image; converting the video screenshot after mean shift filtering into a grayscale image and performing binarization processing to generate a first detection image; performing edge detection on the first detection image to generate a second detection image; performing Hough circle detection on the second detection image to obtain the tunnel entrance and exit contour detection result, wherein performing edge detection on the first detection image to generate the second detection image is specifically performing edge detection on the first detection image according to the firefly algorithm to generate the second detection image, specifically including: selecting N pixels in the first detection image as N fireflies, and randomly dividing the N fireflies into M groups, wherein N and M are natural numbers greater than 1; calculating the brightness of each group of fireflies The brightness L(x,y) of the firefly is determined based on the brightness threshold ST. Among them, x, y are pixel coordinates, H x,y is the grayscale of the pixel with coordinates x, y, L(x,y) max is the maximum brightness of the fireflies in the kth group of fireflies; based on the attraction calculation, update the position x′ of each firefly i,k =x i,k +β(r)(x j,k -x i,k )+α*rand, where x′ i,k is the updated firefly position, x i,k is the position of the fireflies before updating, β(r) is the attraction between fireflies, x j,k is the position of the brightest firefly j in the group, α is the step size perturbation factor, and rand is a number randomly drawn from the (0,1) standard normal distribution; according to the updated position of each firefly, update the brightness of each firefly; determine whether the number of iterations is greater than the preset number of iterations and whether the difference between the extreme values of the firefly brightness in two adjacent iterations is less than the preset threshold. When the preset number of iterations is reached or the difference between the extreme values of the firefly brightness in two adjacent iterations is less than the preset threshold, the position combination corresponding to the current extreme value of the firefly brightness is used as the edge detection result; when the number of iterations is not reached or the difference between the extreme values of the firefly brightness in two adjacent iterations is greater than the preset threshold, update the position of each firefly and continue to execute; Performing vehicle target detection on the video data to obtain a vehicle target detection result; Based on the brightness detection result, the tunnel entrance and exit detection result and the vehicle target detection result, a lighting control instruction is generated, wherein the lighting control instruction is a control strategy for high and low beam switching and brightness of the vehicle lights.
2. The lighting compensation method of the intelligent vehicle lamp according to claim 1, characterized in that: The step of performing vehicle target detection on the video data to obtain a vehicle target detection result comprises: Load the vehicle target detection model; The vehicle target detection model is used to detect vehicle targets in the video data to obtain a vehicle target detection result, wherein the vehicle target detection model is a YOLOv4 model, the backbone network of the YOLOv4 model is replaced by MobileNet, and an LRCA-Net module is added to the head layer network output, and the LRCA-Net module includes a global average pooling layer, a global maximum pooling layer, a channel attention module and a spatial attention module.
3. The lighting compensation method of the intelligent vehicle lamp according to claim 1, characterized in that: The step of generating a light control instruction based on the brightness detection result, the tunnel entrance and exit detection result and the vehicle target detection result comprises: Based on the brightness detection result, when the brightness is too dark, turning on the low beam headlight; Based on the tunnel entrance and exit detection results, when it is detected that the vehicle is entering the tunnel and the external light intensity is lower than a preset threshold, the high beam headlights are automatically turned on; when it is detected that the vehicle is about to leave the tunnel and the external light intensity is higher than a preset threshold, the low beam headlights are automatically switched on; Based on the vehicle target detection result, when it is determined that there is an oncoming vehicle ahead, the high beam is gradually adjusted to the low beam.
4. A lighting compensation device for an intelligent vehicle lamp, characterized in that: include: An acquisition module is used to acquire the video data ahead of the vehicle; The first detection module is used to perform brightness detection on the video data to obtain a brightness detection result, specifically used to determine the height of the region of interest ROI based on the vanishing point detection algorithm of the gLoG filter; dynamically adjust the width of the ROI according to the lane line position in the current video frame being close to the lane line position in the previous video frame; determine the screenshot range according to the height and width of the ROI; and obtain at least one video screenshot; Convert the video screenshot into a grayscale image and obtain the grayscale value of each pixel Among them, i and j are pixel coordinates, P h is the pixel grayscale; according to the grayscale value of each pixel Calculate the average pixel offset in, is the reference grayscale value, N is the number of pixels of the video screenshot; according to the grayscale histogram of the video screenshot, the grayscale average deviation is calculated Among them, i is the gray level, and the gray level cell ranges from 0 to 255, a total of 256 gray levels; calculate the brightness coefficient When the brightness coefficient is greater than 1 and Hist bias When the brightness coefficient is greater than 0, the brightness is normal; when the brightness coefficient is greater than 1 and Hist bias When it is less than 0, the brightness is too dark; when the brightness coefficient is less than 1, the brightness of the video data is normal; The second detection module is used to perform tunnel entrance and exit detection on the video data to obtain the tunnel entrance and exit detection result, specifically for obtaining at least one video screenshot; performing mean shift filtering on the video screenshot to generate a first screenshot image; converting the video screenshot after mean shift filtering into a grayscale image and performing binarization processing to generate a first detection image; performing edge detection on the first detection image to generate a second detection image; performing Hough circle detection on the second detection image to obtain the tunnel entrance and exit contour detection result, wherein performing edge detection on the first detection image to generate the second detection image is specifically performing edge detection on the first detection image according to the firefly algorithm to generate the second detection image, specifically including: selecting N pixels in the first detection image as N fireflies, and randomly dividing the N fireflies into M groups, wherein N and M are natural numbers greater than 1; calculating the brightness of each group of fireflies The brightness L(x,y) of the firefly is determined based on the brightness threshold ST. Among them, x, y are pixel coordinates, H x,y is the grayscale of the pixel with coordinates x, y, L(x,y) max is the maximum brightness of the fireflies in the kth group of fireflies; based on the attraction calculation, update the position x′ of each firefly i,k =x i,k +β(r)(x j,k -x i,k )+α*rand, where x′ i,k is the updated firefly position, x i,k is the position of the fireflies before updating, β(r) is the attraction between fireflies, x j,k is the position of the brightest firefly j in the group, α is the step size perturbation factor, and rand is a number randomly drawn from the (0,1) standard normal distribution; according to the updated position of each firefly, update the brightness of each firefly; determine whether the number of iterations is greater than the preset number of iterations and whether the difference between the extreme values of the firefly brightness in two adjacent iterations is less than the preset threshold. When the preset number of iterations is reached or the difference between the extreme values of the firefly brightness in two adjacent iterations is less than the preset threshold, the position combination corresponding to the current extreme value of the firefly brightness is used as the edge detection result; when the number of iterations is not reached or the difference between the extreme values of the firefly brightness in two adjacent iterations is greater than the preset threshold, update the position of each firefly and continue to execute; A third detection module is used to perform vehicle target detection on the video data to obtain a vehicle target detection result; A control module is used to generate a lighting control instruction based on the brightness detection result, the tunnel entrance and exit detection result and the vehicle target detection result, wherein the lighting control instruction is a control strategy for switching between high and low beams and brightness of the vehicle lights.
5. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the lighting compensation method of the intelligent vehicle lamp as claimed in any one of claims 1 to 3 are implemented.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the lighting compensation method of the intelligent vehicle lamp as claimed in any one of claims 1 to 3 are implemented.
