Automobile night target detection method and self-adaptive high beam system
By introducing the YOLOv8n-Keen1 object detection method and LED matrix light into the adaptive headlight system, adaptive control of high and low beams is achieved, solving the problems of low efficiency and dazzling high beam application in the existing system, and improving the safety and comfort of night driving.
Patent Information
- Application Number
- CN202411596646.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-04-01
AI Technical Summary
The existing adaptive headlight system lacks adaptive control of high beams, resulting in low efficiency of high beams in environments with low night light, and cannot switch in time when following or meeting the car, which can easily lead to dazzling and traffic accidents.
The YOLOv8n-Keen1 target detection method combined with LED matrix lights is used to detect the targets in front of the vehicle in real time, including car headlights, rear lights and pedestrians, and control the local lights of the LED matrix lights to realize adaptive high and low beam switching, and reduce the driver's manual operation frequency through the voice control module.
It improves the accuracy of night object detection, enhances the lighting effect of the driver's night vision, reduces the risk of glare, and improves driving comfort and safety.
Smart Images

Figure CN119741672A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of automobile adaptive headlights and relates to an automobile nighttime target detection method and an adaptive high beam system. Background Art
[0002] Nowadays, the most widely used system in the field of automotive headlights is the adaptive headlight system, which can automatically adjust the lighting angle, height and light type of the low beam according to the driving state of the vehicle and environmental changes, so as to provide better lighting effects to ensure driving safety. However, the defect of the adaptive headlight system is the lack of adaptive control of the high beam. In the low-light environment at night, the use of the high beam can more effectively expand the lighting range and meet the driver's night vision needs. In the existing adaptive headlight system, when following or meeting a vehicle, if the high beam cannot be manually switched to the low beam in time, it will cause dazzle to the drivers and passengers of the passing vehicles, thus causing serious safety problems and easily increasing the probability of nighttime traffic accidents. Moreover, if driving in urban areas, the abuse of the high beam will cause dazzle to pedestrians on the roadside, causing discomfort, resulting in pedestrians not being able to avoid the passing vehicles in time and causing traffic accidents. However, the prior art does not provide a reasonable application of the high beam and a solution for adaptive switching between high and low beams.
[0003] In addition, the use of adaptive high beam systems relies on highly accurate target detection methods. The commonly used target detection methods currently have low accuracy rates at night due to low illumination at night, where vehicle lights are easily confused with surrounding lights and pedestrians are difficult to identify, and are difficult to adapt to the high real-time requirements of the model under driving conditions. Summary of the invention
[0004] In view of the above problems, the present invention provides a method for automobile night target detection and an adaptive high beam system. The target detection method YOLOv8n-Keen1 is improved based on YOLOv8 to improve the detection performance of the external environment in front of the automobile, so as to solve the problem of low target detection accuracy in the environment with low illumination at night; the automobile headlights, automobile taillights and pedestrians are used as detection targets to solve the problem that the automobile lights are easily confused with the surrounding lights and the pedestrians are not easy to be identified; the present invention adopts LED matrix lights as the high beam light source to solve the problem of common light sources (halogen lamps, xenon lamps) lighting The problems of insufficient distance and low light intensity are solved; and when following a vehicle, meeting a vehicle or encountering a pedestrian, the corresponding position information is obtained according to the target detection, and the LED matrix light is partially turned on and off to ensure that the driver obtains sufficient lighting field requirements while solving the problem of glare for the other driver or pedestrians; in the case of a large number of vehicles or pedestrian congestion, the number of vehicles or pedestrians in the image is used as the judgment condition to realize the adaptive high and low beam switching function. The voice control module designed in the present invention performs real-time control of the adaptive high beam system, which reduces the frequency of manual dimming operations by the driver and improves the driving comfort and convenience.
[0005] The technical solution of the present invention is: in the first aspect, the present invention provides a method for detecting a nighttime target of a car, YOLOv8n-Keen1, and the operation steps thereof include:
[0006] (1): Build and annotate a nighttime driving dataset;
[0007] (2): Perform data augmentation on the dataset;
[0008] (3): YOLOv8n is selected as the basic network structure, and the following improvements and optimizations are made to the network structure: ①, the CSPHetBNELAN lightweight feature extraction fusion module is designed to replace the original C2f module; ②, the detection head is improved to Detect_FASFF; ③, the SCDown (Spatial-channel decoupled downsampling) proposed by YOLOv10 is introduced to replace the Conv convolution to reduce the computational cost and the number of parameters. The improved network structure is named YOLOv8n-Keen1;
[0009] (4): Use the night driving data set to train YOLOv8n-Keen1 and generate a model suitable for night vehicle detection of the external environment;
[0010] (5) Conduct comparative experiments and performance analysis with widely used target detection models in the market.
[0011] Furthermore, in step (1), the specific steps of constructing the nighttime driving dataset Night_time_detection are as follows:
[0012] (1.1) Image sources: Some of the images are taken by ourselves, that is, by installing a camera on the front window of the vehicle to shoot real night driving videos and using a handheld camera to collect pedestrian images on the sidewalk. Others are collected from Dark_Zurich_train_anon and Bdd100k, and a total of 4950 images are obtained.
[0013] (1.2) Build a nighttime driving dataset, classify the labels into pedestrians, car headlights (front_light) and car taillights (back_light), and manually and accurately annotate the collected images;
[0014] (1.3) Divide the data set into training set and test set randomly in the ratio of 8:2.
[0015] Furthermore, in step (2), the specific process of data enhancement for the data set is as follows: during the training process, four pictures are randomly selected from the training set, and then randomly scaled, cropped and arranged, and finally spliced to generate new training samples, thereby increasing the diversity and richness of the training samples and improving the generalization ability of the model.
[0016] Furthermore, in step (3), the specific steps of improving and optimizing the basic network model YOLOv8n are as follows:
[0017] (3.1) Design the CSPHetBNELAN lightweight feature extraction fusion module, which integrates heterogeneous convolution with BatchNormalization regularization technology, effectively improving the feature extraction capability and the generalization ability of the model; by introducing the bottleneck layer of CSPNet and through cross-feature fusion, the gradient flow is improved and the feature expression ability is enhanced; by adding the stacking method, that is, the efficient hierarchical aggregation method of aggregating the outputs of multiple convolutional layers, the processing ability of features with different spatial resolutions is improved;
[0018] (3.2) The improved detection head is Detect_FASFF. First, the ASFF method is used to perform spatial filtering and fusion of features at different levels to solve the inconsistency problem of different feature scales. Secondly, FASFF adds levels on the basis of ASFF to make the fusion of features more refined and better handle features of different spatial resolutions. Finally, the detection capability of the YOLOv8 detection head and the feature fusion advantage of FASFF are combined to improve the accuracy of small target detection. It is suitable for the model to detect small targets such as car headlights, taillights and pedestrians, and the detection head is named Detect_FASFF.
[0019] (3.3) The SCDown module is introduced. First, the channel dimension of the input feature map is adjusted through point convolution; then, spatial downsampling is performed through depth convolution; finally, the downsampled feature map is returned;
[0020] The SCDown module simplifies the original downsampling process while still maintaining the accuracy of the model and reducing the computational cost and number of parameters.
[0021] Furthermore, in step (4), the specific steps of training and generating a model suitable for detecting targets in the external environment by vehicles at night are as follows:
[0022] (4.1) Experimental environment. The hardware environment used in this paper is CPU: 12th Gen Intel Core i5-12600KF, GPU: NVIDIA A100-PCIE-40GB, memory 28G;
[0023] The software environment is operating system: ubuntu20.04, cuda11.8, torch2.0.0, python-3.9.7;
[0024] (4.2) Select the optimizer. With the same parameters, use the Night_time_detection dataset to train the test model and find the best optimizer for YOLOv8n-Keen1.
[0025] (4.3) Determine the total number of training epochs, set a larger number of training epochs, and find the number of training epochs at which the precision value after training tends to a steady state;
[0026] (4.4) Module training: First, train the modules individually according to the different improved and optimized modules, and ensure that the training parameters are consistent;
[0027] (4.5) Train the network structure after merging all modules to obtain the final target detection model.
[0028] Furthermore, in step (5), the specific steps of conducting a comparative experiment on the target detection model widely used in the market are as follows:
[0029] (5.1) Query the target detection model through CNKI and obtain the target detection models that have been widely used in the past five years;
[0030] (5.2) Build the operating environment required for various models;
[0031] (5.3) Set the same training parameters as the YOLOv8-Keen1 model, and use the Night_time_detection training set to train multiple target detection models to obtain the corresponding models;
[0032] (5.4) Put the best models obtained from each training into the test set one by one for simulation prediction, and compare and analyze the experimental results in the form of a list.
[0033] In a second aspect, the present invention provides an adaptive high beam system for an LED matrix lamp, comprising:
[0034] Image acquisition module, which acquires the front image of the vehicle in real time during driving;
[0035] The night target detection module uses the YOLOv8n-Keen1 target detection model provided in the first aspect to lock on the vehicles in the image in front of the vehicle using the headlights or taillights of the vehicle, identify pedestrians (pedestrians on the roadside, pedestrians on the zebra crossing, and non-motor vehicle drivers), and obtain their corresponding position information;
[0036] The lighting control module uses Arduino as the controller of the adaptive high beam system, receives information from the target detection model, and then outputs a control signal based on the vehicle position information to control the local on and off function of the LED matrix light to achieve an anti-glare effect;
[0037] The high and low beam adaptive switching module determines the number of vehicles or pedestrians in the image and controls the high and low beam switching;
[0038] The voice control module uses the DFR0715 Gravity voice recognizer to recognize and understand the driver's voice commands ("turn on the high beam" or "turn off the high beam"), and converts the commands into control signals that the system can understand, thereby controlling the on and off of the LED matrix lights;
[0039] Run the adaptive high beam system in real time.
[0040] Further, LED matrix light control method:
[0041] (1): Compared with halogen lamps and xenon lamps commonly used as automotive lighting sources, LED lamps have a longer lighting distance and brighter light intensity;
[0042] (2): LED matrix light control module, no rotating mechanism is required to adjust the light beam. Each LED light in the module can be called individually or adjusted in a zone to achieve precise control of the light beam.
[0043] The beneficial effects of the present invention are: 1. The automobile night target detection method (YOLOv8n-Keen1) has a lightweight effect in terms of parameter quantity, and the accuracy of identifying pedestrians and vehicles driving at night is greatly improved; 2. The automobile headlights and taillights are used as the basis for vehicle identification, which eliminates the confusion between the headlights and the surrounding lights to a certain extent, and distinguishes between moving vehicles and unstarted vehicles, avoiding the problem of misjudging unstarted vehicles as moving vehicles, causing the local on and off operation of LED lights to cause the loss of high beam lighting range; 3. The present invention uses LED matrix lights as the high beam light source, and each LED in the matrix can be called individually, thereby realizing precise control of light distribution, and the LED lights have the advantages of long lighting distance and high illumination. The advantage of high intensity solves the problem of frequent traffic accidents caused by limited vision of vehicle drivers and enhances the safety of night travel; 4. The adaptive high beam system developed in the present invention uses Arduino as the controller, and the 64-bit LED matrix light board is driven by MAX7219. The controller receives the position information and target quantity from the PC, and controls the local lighting of the LED matrix light according to the corresponding information to achieve the anti-glare function, which solves the problem of traffic accidents caused by drivers and pedestrians in passing vehicles who cannot see the road ahead due to glare; 5. The voice control module designed in the present invention performs real-time control of the adaptive high beam system, so that the driver can use voice commands to adjust the high beam on and off, thereby improving driving comfort and convenience. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is an operation flow chart of the automobile night target detection method (YOLOv8n-Keen1) in the present invention;
[0045] Figure 2 : This is a YOLOv8n-Keen1 network structure diagram in an embodiment of the present invention;
[0046] Figure 3 It is a structural diagram of CSPHetBN_Bottlneck and CSPHetBN in an embodiment of the present invention;
[0047] Figure 4 This is a lightweight structure diagram of the CSP HetBNELAN module in an embodiment of the present invention;
[0048] Figure 5 Detect_FASFF workflow diagram in an embodiment of the present invention;
[0049] Figure 6 It is a comparison diagram of SCDown and Conv structures in an embodiment of the present invention;
[0050] Figure 7 is a flow chart of an adaptive high beam system designed in an embodiment of the present invention;
[0051] Figure 8 This is a 64-bit LED matrix light control circuit diagram in an embodiment of the present invention;
[0052] Fig. 9 It is a DFR0715 Gravity speech recognition circuit diagram in an embodiment of the present invention;
[0053] Fig.10 It is a flow chart of the adaptive high beam system control method in an embodiment of the present invention. DETAILED DESCRIPTION
[0054] The specific technical scheme of the present invention is further described in detail below with reference to specific examples.
[0055] As shown in the figure, Figure 1 This is a flow chart of the car night target detection method (YOLOv8n-Keen1) designed by the present invention. The specific steps are as follows:
[0056] (1): Build and annotate a nighttime driving dataset;
[0057] (2): Perform data augmentation on the dataset;
[0058] (3): YOLOv8n is selected as the basic network structure, and the following improvements and optimizations are made to the network structure: ①, CSPHetBNELAN lightweight feature extraction fusion module is designed to replace the original C2f module; ②, the detection head is improved to Detect_FASFF; ③, SCDown (Spatial-channel decoupled downsampling) proposed by YOLOv10 is introduced to replace Conv convolution to reduce the computational cost and the number of parameters. The improved network structure is named YOLOv8n-Keen1, as shown in Figure 2 As shown;
[0059] (4): Use the night driving data set to train YOLOv8n-Keen1 and generate a model suitable for night vehicle detection of the external environment;
[0060] (5) Conduct comparative experiments and performance analysis with widely used target detection models in the market.
[0061] Furthermore, in step (1), the specific steps of constructing the nighttime driving dataset Night_time_detection are as follows:
[0062] (1.1) Image sources: Some of the images are taken by ourselves, that is, by installing a camera on the front window of the vehicle to shoot real night driving videos and using a handheld camera to collect pedestrian images on the sidewalk. Others are collected from Dark_Zurich_train_anon and Bdd100k, and a total of 4950 images are obtained.
[0063] (1.2) Construct a night driving data set and divide the labels into pedestrians, car headlights (front_light) and car taillights (back_light). The main reason why the labels are not directly set as vehicles but defined as car headlights and car taillights is that: first, to distinguish between moving vehicles and unstarted vehicles, the anti-glare function implemented in the present invention is mainly aimed at the drivers and passengers in the vehicle and pedestrians on the roadside. Therefore, in order to avoid the loss of high beam lighting range caused by misidentification of unstarted vehicles, the two features of car headlights and car taillights are selected to identify the vehicle; second, in the low-light environment at night, the car lights are easily confused with the surrounding lights. Therefore, by learning the car headlights and taillights, their recognition accuracy is improved to avoid misjudgment. Finally, the collected images are accurately labeled through the labelImg program;
[0064] (1.3) The data set is randomly divided into training set and test set in a ratio of 8:2.
[0065] Furthermore, in step (2), the specific steps of performing data enhancement on the data set are as follows:
[0066] (2.1) The core idea of mosaic data augmentation technology is to randomly combine four images to generate new training samples;
[0067] (2.2) During the training process, four images are randomly selected from the training set, and then randomly scaled, cropped, and arranged, and finally spliced to generate new training samples, which increases the diversity and richness of the training samples;
[0068] (2.3) Input the generated new training samples into the model for training, so that the model can learn more different scenes and perspectives, thereby improving the generalization ability of the model;
[0069] (2.4) During the data processing, the data of four images can be processed in parallel without increasing the GPU memory usage, thereby improving the detection efficiency of the model.
[0070] Furthermore, in step (3), the specific steps of improving and optimizing the basic network model YOLOv8n are as follows:
[0071] (3.1) Design the CSPHetBNELAN lightweight feature extraction fusion module. The specific method is as follows: ① First, the module uses heterogeneous convolution composed of 1×1 and 3×3 convolutions mixed in a certain proportion to reduce the number of parameters and improve the feature extraction capability, and constructs a batch normalization layer to form HetBNConv;
[0072] In a standard convolutional layer, assume that the size of the input (input feature map) is D i ×D i ×M, the size of the output feature map is D o ×D o ×N, and the output feature map is composed of N filters of size K×K×M;
[0073] Among them, D i is the spatial width and height of the input square feature map, M is the input depth, and D o is the spatial width and height of the output square feature map, N is the output depth, and K is the kernel size; therefore, the total computational cost of the Lth layer can be expressed as:
[0074] FL S =D o ×D o ×M×N×K×K
[0075] In heterogeneous convolution, the P part is defined to control the number of different types of kernels in the convolution filter. 1 / P of the total number of kernels will be used for K×K kernels, and the remaining (1-1 / P) will be used for 1×1 kernels. The computational cost of the K×K kernel in the filter with the P part on the L layer is:
[0076] FL K =(D o ×D o ×M×N×K×K) / P
[0077] Therefore, the size of (MM / P) kernels is 1×1, and the computational cost is:
[0078]
[0079] The total computational cost of the Lth layer of heterogeneous convolution is: FL HC =FL K +FL1;
[0080] Compared with the standard convolution, the total reduction in computation R can be expressed as:
[0081]
[0082] Batch Normalization, as a regularization technique, is integrated into heterogeneous convolution to standardize the distribution of input data, reduce internal covariate shift, and speed up the model training process. Since the input data is normalized, the gradient is more stable during the back propagation process, and the generalization ability of the model is improved, reducing the risk of overfitting. The formula is as follows:
[0083] With d-dimensional input x=(x (1) ...x (d) ) Normalize each dimension, set μ as the mean and σ as the standard deviation:
[0084]
[0085] In the formula, γ is used for scaling, β is used for translation, and ε is a very small number to avoid the denominator being 0;
[0086] ②. Secondly, Figure 3 From the analysis, it can be seen that the CSPHetBN_Bottleneck module achieves stronger feature extraction, compression and regularization effects through HetBNConv, and introduces the bottleneck layer of CSPNet, which is responsible for processing feature maps at a specific depth and has gradient flow characteristics;
[0087] The CSPHetBN module is composed of multiple CSPHetBN_Bottleneck modules. This network architecture realizes partial cross-fusion of features and further feature extraction, which enhances the feature expression ability, network stability and classification accuracy.
[0088] Specific implementation steps of CSPHETBN: The input feature map is convolved through cv1, and the result is split into two parts. One part directly waits for the final splicing, and the other part is processed by each CSPHETBN_Bottleneck module once, and the output is collected. Finally, all parts are spliced, convolved through cv2, and the final feature map is output;
[0089] ③. Again, by Figure 4 From the analysis, we can see that the stacking feature added to CSPHetBN is different from the original way of processing the input feature map. Stacking means that a part of the output of each layer is separated as the input of the next layer to continue processing through convolution, and the remaining part directly enters concat to wait for the final splicing. This efficient hierarchical aggregation method that aggregates the outputs of multiple convolutional layers can better improve the feature extraction capability.
[0090] ④. Finally, the CSPHetBNELAN module obtained by lightweight processing the module by reducing the convolutional layer replaced the original C2f module of YOLOv8, making the network structure lightweight, stable and efficient, and improving the gradient flow and feature expression capabilities of the model;
[0091] (3.2) Improve the detection head of YOLOv8 to Detect_FASFF. The specific method is as follows:
[0092] ① First, ASFF is used to solve the inconsistency problem between different feature scales of the single shot detector (SSD) based on the feature pyramid. The core idea is to retain useful information and remove conflicting information by adaptively filtering and fusing features at different levels;
[0093] ② Secondly, FASFF is improved on the basis of ASFF, adding a level to make it have four levels, making the fusion of features more refined and better able to handle features of different spatial resolutions. In short, it improves the detection capability of small targets or long-distance targets, and is more suitable for the target detection of automobile headlights and taillights in the present invention;
[0094] ③Finally, FASFF is integrated into the YOLOv8 detection head, using the detection capability of YOLOv8 and the feature fusion advantage of FASFF to improve the recognition accuracy of small targets; Figure 5 From the analysis, we can see that the workflow of Detect_FASFF is mainly divided into: first, feature fusion, integrating features of different levels into a unified spatial resolution; second, weight learning, learning how to weightedly combine features of different levels through training; third, fusion output: according to the learned weights, the integrated features are fused to generate the final feature map;
[0095] (3.3) Introduce the SCDown module. The specific method is as follows:
[0096] like Figure 6 Analysis shows that SCDown first adjusts the channel dimension of the input feature map through 1×1 point convolution, then performs spatial downsampling through 3×3 depth convolution, and finally returns the downsampled feature map; compared with the conventional standard convolution of the YOLO series with a stride of 2, SCDown can simultaneously achieve spatial downsampling (from H×W to ) and channel transformation (from C to 2C), the computational cost of which is given by Down to and the number of parameters given by Drop to O(2C 2+18C), this change retains the information in the downsampling process while reducing computational redundancy and increasing the computing speed.
[0097] Furthermore, in step (4), the specific steps of training and generating a model suitable for detecting targets in the external environment by vehicles at night are as follows:
[0098] (4.1): Configure the experimental environment. The hardware environment used in this invention is CPU: 12th Gen Intel Corei5-12600KF, GPU: NVIDIA A100-PCIE-40GB, memory 28G;
[0099] The software environment is operating system: ubuntu20.04, cuda11.8, torch2.0.0, python-3.9.7;
[0100] (4.2): Set the calibration parameters. First, set the input image size to 640×640 during training. Second, divide the entire training sample into 16 batches. Finally, because the network structure is improved, the pre-training mode is turned off.
[0101] (4.3): Select the optimizer. When setting the above calibration parameters, apply the Night_time_detection dataset and train the commonly used optimizers (SGD, Adam, AdamW, NAdam, RAdam, RMSProp, etc.) one by one. Compare the final training results to find the best optimizer for YOLOv8n-Keen1.
[0102] (4.3) Determine the total number of training epochs, set a larger number of training epochs, and find the number of training epochs at which P, R, mAP, and mAP50-95 all tend to a steady state;
[0103] (4.4) Module training: First, train the modules individually according to the different improved and optimized modules, and ensure that the training parameters are consistent;
[0104] (4.5) Train the network structure after merging all modules to obtain the final nighttime vehicle detection model for external environment targets.
[0105] Furthermore, in step (5), the specific steps of conducting a comparative experiment on the target detection methods widely used in the market are as follows:
[0106] (5.1) Search for target detection methods through CNKI and obtain the target detection methods that have been widely used in the past five years, such as:
[0107] SSD is a classic single-stage target detection method that uses convolutional neural networks for feature extraction and is suitable for multi-scale detection;
[0108] RT-DETR (Real-Time DEtection TRansformer) is a real-time end-to-end detector based on the DETR architecture, which has the ability to process and analyze visual data quickly and accurately;
[0109] The YOLO series of methods (YOLOv3 / YOLOv4 / YOLOv7 / YOLOv10) are widely used in the field of computer vision due to their fast speed, high accuracy, multi-scale prediction and flexible network structure;
[0110] (5.2) Build the operating environment required for various models;
[0111] (5.3) Set the same training parameters as the YOLOv8-Keen1 model, use the Night_time_detection training set to train multiple target detection models, and obtain the corresponding optimal model;
[0112] (5.4) Put the best models obtained from each training into the test set one by one for simulation prediction, and compare and analyze the experimental results in the form of a list;
[0113] In order to demonstrate the effects of the improved model design, the present invention uses P (Precision), R (Recall), mAP (Mean Average Precision), mAP50-95, parameter amount, computational effort (FLOPs), and model size as model evaluation criteria; From the analysis in Table 1, it can be seen that in the low-parameter model, YOLOv7-tiny is relatively superior to YOLOv5n and YOLOv10n in all aspects, but YOLOv8n-Keen1 is 4.9%, 5.6%, and 8.6% higher than the YOLOv7-tiny model in R, mAP50, and mAP50-95, respectively. It has superior comprehensive performance in the low-parameter model; compared with the high-parameter model Compared with the three models of SSD, RT-DETR and YOLOv3n, YOLOv8n-Keen1 is about 1 / 10 of RT-DETR in terms of parameter quantity, computational complexity and model size, and far exceeds RT-DETR in terms of P, R, mAP50 and mAP50-95 effects. It is lower than SSD only in P value. In summary, the YOLOv8n-Keen1 model proposed in the present invention has better performance in different ranges. The model not only has the advantage of being lightweight, but also has higher detection accuracy, and is more suitable for actual nighttime vehicle detection of external environment targets.
[0114] Table 1 is a comparison and analysis table of multi-model performance
[0115]
[0116]
[0117] Figure 7 The flowchart of the adaptive high beam system based on LED matrix lamp is designed as follows:
[0118] (1) Image acquisition module, the specific process is as follows:
[0119] (1.1) First, we chose the camera from Ruierweishi, which uses the 300,000-pixel high-light chip OV7725, with a high frame rate of up to 60 frames per second, and is compatible with USB1.1 low-speed and USB2.0 full-speed interfaces, supports Windows / Linux systems, and is plug-and-play;
[0120] (1.2) Connect the host computer via USB cable, import the OpenCV library, call the camera and set the resolution to 640×640, and obtain the front image of the vehicle in real time during driving as the input of the night target detection module;
[0121] (2) Night target detection module, the specific detection process is as follows:
[0122] (2.1) Identify vehicles and pedestrians, import the YOLO and serial libraries, read the target category information from the target file, and use the YOLOv8n-Keen1 target detection model provided in the first aspect to perform target detection, lock the vehicles in the image in front of the vehicle according to the headlights or taillights of the vehicle, and identify pedestrians (pedestrians on the roadside, pedestrians on the zebra crossing, and drivers of non-motor vehicles);
[0123] (2.2) Obtain the corresponding position information of vehicles and pedestrians based on the detection frame. The target detection frame position information is usually represented by the following four parameters: center point coordinates (x, y), width w, height h. The specific mathematical formula is as follows:
[0124] The formula for obtaining the actual detection frame position is:
[0125]
[0126] Where σ is the sigmoid function, t x and t y is the offset of the network output, c x and c y is the coordinate of the upper left corner of the network unit, p w and p h is the width and height of the predefined anchor box, t wand t h is the scaling factor of the network output;
[0127] The formula for obtaining the position of the predicted detection box is:
[0128]
[0129] Where i and j are the indices of the network unit, S is the size of the network, and W and H are the width and height of the image;
[0130] (2.3) Define the position information conversion function to convert the 640×640 image size into a format suitable for Arduino;
[0131] (2.4) Count the number of each target in each frame of the video frame;
[0132] (2.5) Set up serial port communication and send the location information and quantity of each detected target to the Arduino controller through the serial port;
[0133] (3) Lighting control module: The specific steps are as follows:
[0134] (3.1), circuit connection, such as Figure 8 From the analysis, we know that Arduino is the controller of the adaptive high beam system, and the 64-bit LED matrix light board is driven by MAX7219. Connect the DIN driven by MAX7219 to the 11th pin of the Arduino controller, the CLK to the 13th pin, the CS to the 10th pin, the VCC to the 5V pin, and the GND to the GND pin of the Arduino.
[0135] (3.2) Import the LedControl library, define and initialize the pins connected to MAX7219, set the corresponding serial port communication, store the detection box position information through the DetectionBox structure, and set the initial state of the LED matrix light to full brightness;
[0136] (3.3) By receiving the detection frame position information, determining the detection frame range, outputting the control signal to turn off the LED lights in the detection frame and turn on the LED lights outside the detection frame, thereby controlling the local on and off of the LED matrix lights to achieve the anti-glare effect of the car high beam; wherein, in order to achieve the anti-glare effect, the detection frame determination methods of pedestrians and car lights (headlights, taillights) are different. For pedestrians, the detection frame determination method in (2.2) above can be used, and for car lights, if the above method is used, the anti-glare effect for drivers and passengers cannot be achieved. Therefore, the present invention achieves the anti-glare effect for vehicle drivers and passengers by keeping the original detection frame width of the car lights unchanged and expanding the height upward to the top of the image;
[0137] (4) High and low beam adaptive switching module: the controller reads and receives the number information of three targets, namely, the car headlights, the car taillights and the pedestrians, from the serial port, processes and updates the number of the car headlights and taillights, and then decides whether to turn off all LED lights according to the total number. That is, when the total number of the car headlights and taillights is greater than or equal to 3, all LED lights (high beams) are turned off and adaptively switched to low beams.
[0138] (5) Voice control module. The specific design steps are as follows:
[0139] (5.1), circuit connection, by Fig. 9 From the analysis, we know that DFR0715 Gravity is the voice recognition module of ADB system. The SCL and SDA of DFR0715 are connected to the I2C interface of Arduino controller, VCC is connected to 5V, and GND is connected to ground.
[0140] (5.2) Voice recognition processing: If the command contains "turn on high beam", set highbeam to True and turn on all LED lights; if the command contains "turn off high beam", set highbeam to False and turn off all LED lights;
[0141] (5.3) Serial port data processing: if highbeam is True and useful data is received in the serial port, the data is read through the serial port and the lighting control module is called for processing. In addition, the high beam status can be adjusted at any time by voice in the lighting control module.
[0142] (6) Run the adaptive high beam system in real time. The specific steps are as follows:
[0143] (6.1) Connect the Arduino controller and camera to the PC via the USB port, connect the MAX7219 to the DFR0715 Gravity and the Arduino controller respectively, connect the DIN, CLK, CS, VCC and GND of the MAX7219 driver to the Pin 11, Pin 13, Pin 10, 5V and GND of the Arduino controller in sequence, and connect the SCL, SDA, VCC and GND of the DFR0715 Gravity to the SCL, SDA, 5V and GND of the Arduino controller in sequence;
[0144] (6.2) Start the target detection program on the PC and turn on the high beam mode (LED matrix lights are all on) through voice. Call the camera to perform target detection on the real-time night driving video. When a vehicle or pedestrian is detected, keep the LED matrix lights all on. When the number of detected vehicles is equal to or greater than the limit, turn off the LED matrix and switch to low beam mode. When the number of detected vehicles is less than the limit, obtain the location information of the detected vehicle or pedestrian, and then turn off the lights in the corresponding area of the LED matrix. In addition, the high beam mode can be turned off or on at any time through voice during operation. The specific operation process is as follows: Fig.10 As shown;
[0145] (6.3) In order to verify the effectiveness (or practicality) of the adaptive high beam system, the present invention sets up 7 typical situations to conduct the adaptive high beam system test experiment, namely: there is only 1 car in the image, 2 cars, more than or equal to 3 cars, no vehicles or pedestrians are detected, no more than 3 pedestrians, more than 3 people and people and cars exist at the same time; it is proved that in the cases where there is only 1 car, 2 cars, no vehicles or pedestrians are detected, no more than 3 pedestrians, and people and cars exist at the same time (but the number of cars is less than 3, and the number of pedestrians is no more than 3), the anti-glare effect of the LED matrix light is significant.
[0146] Further technical solutions, LED matrix light control module:
[0147] (1) LED lights are used as high beam light sources. Compared with halogen lamps and xenon lamps commonly used as automotive light sources, LED lights have a longer lighting distance and brighter light intensity, which is more suitable for providing drivers with a bright and wide field of vision in low-light environments at night;
[0148] (2) LED matrix light control module: If the traditional rotating mechanism is used to adjust the light beam, it is not only time-consuming and has low real-time performance, but also the steering angle is limited, resulting in a narrow field of vision for the vehicle driver, which is easy to cause traffic accidents. However, in the control module used in the present invention, each LED light can be called individually or mobilized in a zone to achieve precise control of the light beam, which solves the time-consuming problem caused by the rotating mechanism, improves the real-time performance of controlling the on and off operation of the LED matrix light, increases the driver's field of vision at night, and reduces the probability of traffic accidents at night.
Claims
1. A method for detecting a vehicle target at night, characterized in that: The operation steps are as follows: Step (1): Build a nighttime driving dataset and annotate it; Step (2): Perform data enhancement on the dataset; Step (3): Select YOLOv8n as the basic network structure and improve and optimize the network structure; Step (4): Use the nighttime driving data set to train YOLOv8n-Keen1 to generate a model suitable for nighttime vehicle detection of the external environment; Step (5): Perform comparative experiments and performance analysis with existing target detection models.
2. A method for detecting a vehicle target at night according to claim 1, characterized in that: In step (1), the specific steps of building a nighttime driving data set are as follows: (1.1): Image sources: Some of the images are taken by ourselves, that is, by installing a camera on the front window of the vehicle to shoot real night driving videos and using a handheld camera to collect pedestrian images on the sidewalk. Others are collected from Dark_Zurich_train_anon and Bdd100k, and a total of 4950 images are obtained. (1.2): Build a nighttime driving dataset, classify labels into pedestrians, car headlights, and car taillights, and manually and accurately annotate the collected images; (1.3): Divide the data set into training set and test set randomly in the ratio of 8:
2.
3. A method for detecting a vehicle target at night according to claim 1, characterized in that: In step (2), the specific process of data enhancement for the data set is as follows: during the training process, four pictures are randomly selected from the training set, and then randomly scaled, cropped and arranged, and finally spliced to generate new training samples.
4. A method for detecting a vehicle target at night according to claim 1, characterized in that: In step (3), the specific steps of improving and optimizing the basic network model YOLOv8n are as follows: (3.1): Design CSPHetBNELAN lightweight feature extraction fusion module to replace the original C2f module; (3.2): Improved detection head to Detect_FASFF; (3.3): The SCDown module proposed by YOLOv10 is introduced to replace the Conv convolution to reduce the computational cost and the number of parameters. The improved network structure is named YOLOv8n-Keen1.
5. A method for detecting a vehicle target at night according to claim 4, characterized in that: In step (3.1), heterogeneous convolution is integrated with Batch Normalization regularization technology to improve feature extraction capability and model generalization ability; by introducing the bottleneck layer of CSPNet and through cross-feature fusion, the gradient flow is improved and the feature expression ability is enhanced; by adding a stacking method, that is, an efficient hierarchical aggregation method that aggregates the outputs of multiple convolutional layers, the processing capability of features with different spatial resolutions is improved.
6. A method for detecting a vehicle target at night according to claim 4, characterized in that: In step (3.2), the detection head is improved to Detect_FASFF: first, ASFF is used to perform spatial filtering and fusion of features at different levels to solve the inconsistency problem of different feature scales; Secondly, FASFF adds layers on the basis of ASFF to make the fusion of features more refined and process features with different spatial resolutions; Finally, the detection capability of the YOLOv8 detection head and the feature fusion advantage of FASFF are combined to improve the accuracy of small target detection, and the detection head is named Detect_FASFF.
7. A method for detecting a vehicle target at night according to claim 4, characterized in that: In step (3.3), the process of introducing the SCDown module is: first, the channel dimension of the input feature map is adjusted through point convolution; Then, spatial downsampling is performed through depthwise convolution; Finally, the downsampled feature map is returned; the SCDown module simplifies the original downsampling process, maintains the accuracy of the model, and reduces the computational cost and number of parameters.
8. The method for detecting a vehicle target at night according to claim 1, characterized in that: In step (4), the specific steps of training and generating a model suitable for detecting targets in the external environment by vehicles at night are as follows: (4.1): Experimental environment. The hardware environment used is CPU: 12th Gen Intel Core i5-12600KF, GPU: NVIDIAA100-PCIE-40GB, memory 28G; The software environment is operating system: ubuntu20.04, cuda11.8, torch2.0.0, python-3.9.7; (4.2): Select the optimizer. When setting the same parameters, use the Night_time_detection dataset to train the commonly used optimizers one by one to find the best optimizer for YOLOv8n-Keen1. Among them, the commonly used optimizers include SGD, Adam, AdamW, NAdam, RAdam, and RMSProp; (4.3): Determine the total number of training rounds, set a larger number of training rounds, and find the number of training rounds at which the precision value after training tends to a steady state; (4.4): Train in different modules. First, train the modules individually according to the different improved modules and ensure the training parameters are consistent. (4.5): Train the network structure after merging all modules to obtain the final object detection model.
9. The method for detecting a vehicle target at night according to claim 1, characterized in that: In step (5), the specific steps of the comparative experiment with the existing target detection model are as follows: (5.1): Query the target detection model through CNKI and obtain the target detection models that have been widely used in the past five years; (5.2): Build the operating environment required for various models; (5.3): Set the same training parameters as the YOLOv8-Keen1 model, use the Night_time_detection training set to train multiple target detection models, and obtain the corresponding models; (5.4): Put the best models obtained from each training into the test set one by one for simulation prediction, and compare and analyze the experimental results in the form of a list.
10. An adaptive high beam system for LED matrix lamps, characterized in that: The specific process is as follows: Image acquisition module: Use the Ruierweishi camera, connect it to the host via a USB cable, and obtain the front image of the vehicle in real time during driving; Night object detection module: (1): Target detection and recognition: read target category information from the target file, use the YOLOv8n-Keen1 model to detect targets, lock on passing vehicles based on the headlights or taillights, and identify pedestrians; (2): Obtain the corresponding position information of vehicles and pedestrians based on the detection frame; (3): Define the position information conversion function to convert the 640×640 image size into a format suitable for Arduino; (4): Count the number of each target in each frame of the video frame; (5): Set up serial port communication and send the location information and quantity of each detected target to the Arduino controller through the serial port; Lighting control module: (1): Circuit connection, connect the Arduino controller to the 64-bit matrix light board driven by MAX7219; (2): Import the LedControl library, define and initialize MAX7219, define the DetectionBox structure to store location information, and initialize the matrix light status; (3): Receive the detection frame position information, and control the local lighting of the LED matrix light according to the corresponding information to achieve the anti-glare function; High and low beam adaptive switching module: obtain the number of car headlights, taillights and pedestrians from the serial port through the controller, count the total number of car headlights and taillights, that is, the total number of vehicles in the figure, and set the high beam mode to execute when the total number of vehicles is less than 3, otherwise switch to low beam mode; Voice control module: (1): Circuit connection, connect the Arduino controller to the DFR0715 Gravity speech recognizer; (2): Define a speech recognition function. When receiving the voice command "turn on high beam", set highbeam to True and control all LED lights to turn on. When receiving the voice command "turn off high beam", set highbeam to True and control all LED lights to turn off. (3): Set the voice recognition function interface and judgment conditions in the lighting control module to ensure that the high beam status can be adjusted by voice at any time in the lighting control module.