Lane line detection network system and method based on global semantic enhancement
By introducing global semantic enhancement modules and composite loss functions into the lane line detection network, the problem of insufficient robustness in complex scenarios in the existing technology is solved, and the lane line detection effect is achieved with high precision and real-time.
Patent Information
- Application Number
- CN202510258523.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-06
- Publication Date
- 2025-06-20
AI Technical Summary
The existing lane line detection technology is not robust enough in complex scenarios, cannot effectively integrate global semantic information, and the loss function does not constrain the shape and angle of lane line, making it difficult to meet the needs of autonomous driving systems for high precision and real-time.
A lane line detection network system based on global semantic enhancement is designed. By introducing a global feature extraction module (GEM) and a top-level auxiliary module (TLAM), combining expansion convolution, multi-head self-attention mechanism and self-attention mechanism, the structure and loss function of the lane line detection model are optimized. The composite loss function is used to combine angle loss and generalized line IoU loss to improve the accuracy and robustness of lane line detection.
It significantly improves the accuracy and robustness of lane line detection in complex environments, can maintain high detection accuracy in complex scenarios such as occlusion, curves, and insufficient lighting, and improves the real-time and adaptability of the model.
Smart Images

Figure CN120182936A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of computer vision and autonomous driving, and particularly relates to a lane line detection system and method based on a deep learning framework, which is particularly applicable to lane line recognition and positioning in complex scenarios. Background Art
[0002] Lane line detection is a key technology in autonomous driving and advanced driver assistance systems (ADAS). The goal is to accurately identify and locate lane lines from images captured by on-vehicle cameras. Traditional methods rely on image processing techniques such as Canny edge detection, Hough transform, etc., extract edge features and combine processing steps such as color space conversion, binarization, denoising, etc., and finally use fitting techniques to detect lane lines. However, these methods have limitations: they rely on manual parameter adjustment, cannot adapt to complex road conditions and lighting environments, and perform poorly in processing scenarios such as occlusion, low light, and curved lanes, making it difficult to meet the high-precision requirements of autonomous driving.
[0003] With the progress of deep learning, lane line detection methods based on convolutional neural networks (CNNs) have gradually become the mainstream. CNN methods can automatically extract image features and overcome the limitations of traditional methods. Current CNN models are mainly divided into methods such as segmentation, line detection, anchor points, and polynomial regression, but there are still some problems. First, existing models perform poorly in global semantic information fusion and fail to effectively combine global semantic information such as road structure and vehicle position, resulting in poor detection effects in complex scenarios. Second, traditional global feature extraction methods require deep convolutional layers, increasing model complexity and reducing inference speed, making it difficult to meet real-time requirements. Finally, existing loss functions, such as IoU loss, do not fully consider the continuity of lane line shapes and angular deviations, resulting in non-smooth prediction results or deviations from real lane lines.
[0004] Therefore, there is an urgent need for a lane line detection solution that can efficiently fuse global semantic information, optimize the model structure, and improve the adaptability of the loss function to address the challenges of complex scenarios and meet the high-precision and real-time requirements of autonomous driving systems. Summary of the Invention
[0005] Object of the Invention: The present invention provides a lane line detection network system and method based on global semantic enhancement, aiming to solve the problems of insufficient robustness in lane line detection in complex scenarios, low efficiency and inaccuracy in global semantic feature extraction, and insufficient constraints of the loss function on lane line shapes and angles in the prior art.
[0006] Technical Solution: The present invention provides a lane line detection solution based on global semantic enhancement, including the following steps:
[0007] (1) Preprocess the images containing lane lines, including operations such as image normalization and enhancement, to ensure the quality and diversity of the input data and complete the production of the dataset.
[0008] (2) Introduce a new global feature extraction module (GEM) after the backbone network (such as ResNet) of the existing lane line detection model. This module consists of two branches: the lower branch uses the MLP-mixer network to extract rough global features, and the upper branch finely processes the context information through dilated convolution and multi-head self-attention mechanism to obtain more accurate global semantic features.
[0009] (3) Introduce a top-level auxiliary module (TLAM) to further process the global feature map obtained from the GEM module. Distill the features through the self-attention mechanism and optimize the calculation process through DropKey. Finally, transfer the processed features to the lane line classification and regression head.
[0010] (4) Design a composite loss function, combining Angle Loss and Generalized Line IoU Loss (GLIoULoss), to optimize the prediction accuracy of the lane line shape and angle.
[0011] (5) Substitute the predicted lane line position coordinates and the ground truth into the composite loss function, calculate the result and then perform backpropagation to complete the model training.
[0012] Furthermore, the implementation process of step (1) is as follows:
[0013] Normalize the input image by the mean and standard deviation to ensure that the image data is processed under a unified scale and avoid the influence of the distribution difference of the input data on the training effect of the model. Augment the data by means of random rotation, translation, scaling, etc. to increase the robustness of the model and improve the generalization ability of the model in various scenarios.
[0014] Furthermore, the introduction of the GEM module in step (2) mainly includes two branches, which are used to extract rough global features and fine global features respectively. These two branches work together through different mechanisms, aiming to capture global information at different levels to enhance the performance of the lane line detection model in various environments. The implementation process of the GEM module is as follows:
[0015] The lower branch of the GEM module uses an MLP-Mixer network to process the input feature map. First, the input feature map comes from the top-layer output of the backbone network. After channel scaling and normalization, the feature map is fed into the MLP-Mixer network for preliminary extraction of global features. The MLP-Mixer network establishes global feature relationships through the interaction of spatial features and channel features, which lays the foundation for subsequent fine-grained feature extraction. This lower branch mainly captures the rough global information in the image and provides a basic global semantic framework for the model.
[0016] On this basis, the upper branch of the GEM module further refines the extraction of global features. The upper branch expands the receptive field of the convolution through dilated convolution, so as to better capture long-range spatial dependence relationships. Dilated convolution can cover a wider range of context information while maintaining computational efficiency, which is particularly important for the localization of lane lines. Then, the upper branch divides the feature map into multiple sub-blocks and processes them in parallel through a multi-head mechanism. The features in each sub-block are weighted and summed by calculating similarities, which enables the network to focus simultaneously at multiple spatial positions and effectively capture long-distance feature dependencies.
[0017] To further enhance the representation ability of global features, the present invention introduces the SimAm (Simple Attention Module) module as a supplement to the 3D spatial attention mechanism. The SimAm module is a parameter-free attention mechanism that can strengthen the expression of global semantic information and optimize the processing of spatial information in lane line detection. The introduction of this module enables the GEM module to not only capture 2D spatial relationships but also process more complex 3D spatial features, improving the network's adaptability to changes in the shape and angle of lane lines.
[0018] Through the above design, the GEM module can provide a relatively fine and comprehensive solution for global feature extraction. The rough features and fine features extracted by the lower branch and the upper branch will be weighted and fused in the feature fusion stage to ensure that the extracted global information has higher accuracy and richness. This dual-branch structure enables the GEM module to effectively improve the accuracy of lane line detection in complex scenarios, especially in cases of occlusion, curves, and insufficient lighting, and can maintain strong robustness.
[0019] Furthermore, the implementation process of the top-layer auxiliary module (TLAM) in step (3) is as follows:
[0020] The Top-Level Auxiliary Module (TLAM) introduced in this invention aims to enhance the role of global semantic features in lane detection and improve the detection ability of the model in complex scenarios. The TLAM module processes the global feature map from the GEM module, optimizes the transmission of global semantic information using the self-attention mechanism, and integrates it into the prediction process of lane classification and regression.
[0021] The processing of TLAM starts with inputting the global feature map output by the GEM module. To enhance the global semantic expression, a residual network is first used to process the feature map to enhance its semantic representation. The residual network helps to solve the problem of vanishing gradients that may occur in deep networks and ensures information flow through skip connections, enhancing the model's learning ability. The processed feature map is fed into the self-attention mechanism, which automatically adjusts the weights between features, helping the model to focus on important regions, especially effective in cases such as lane line bending, occlusion, and complex backgrounds.
[0022] In addition, TLAM introduces the DropKey mechanism to optimize the calculation process. By randomly discarding some calculations, the computational amount is reduced and the inference efficiency is improved without affecting the final result. This optimization ensures that TLAM maintains a high computational efficiency while enhancing global semantic information.
[0023] After these processes, the optimized feature map is passed to the lane classification and regression head. Through this process, TLAM effectively distills and transmits global semantic features to lane prediction, improving the classification and localization accuracy, especially in complex scenarios. Generally speaking, the TLAM module enhances the expression ability of global semantic features through the self-attention mechanism, residual network, and DropKey optimization, improving the accuracy and robustness of lane detection, especially performing well in cases such as occlusion, bending, and insufficient lighting.
[0024] Furthermore, the implementation process of step (4) is as follows:
[0025] To cope with the common complex scenarios in lane detection, especially when there are large deviations in the shape and angle of lane lines, a single loss function cannot fully constrain the prediction results. To improve the model performance, this invention proposes a composite loss function that combines the Angle Loss and the Generalized Line IoU Loss (GLIoU Loss), effectively constraining the angle change and shape regression of lane lines, thus achieving more accurate lane detection.
[0026] First, the Angle Loss is used to constrain the angular difference between the predicted lane line and the actual lane line. In actual detection, a lane line is usually composed of several consecutive points, and the angular difference between these points is crucial for the accurate representation of the lane line. Therefore, the Angle Loss calculates the angular difference between each short segment of the predicted lane line and the corresponding segment of the actual lane line. Specifically, for the predicted point and its previous point as well as the ground truth point and its previous point calculate the included angle θ between the predicted line segment and the ground truth line segment i :
[0027]
[0028] Then, by taking the average of the angular differences between all predicted segments and ground truth segments, the angular difference of the overall lane line is obtained:
[0029]
[0030] The final Angle Loss is calculated by the following formula:
[0031] L angle = 1 - cos(θ)
[0032] This design of the Angle Loss can ensure that when the model predicts the lane line, it minimizes the angular difference from the actual lane line as much as possible, so that the predicted lane line shape is closer to the actual lane line. Especially in complex situations such as curves, it can greatly improve the prediction accuracy.
[0033] Secondly, the Generalized Line IoU Loss (GLIoU Loss) is another core innovation of the present invention. Different from the traditional IoU (Intersection over Union) loss, GLIoU considers the geometric relationship between points by expanding each predicted point and its corresponding ground truth point into rectangles, thus providing a smoother and more continuous lane line regression result. To calculate the GLIoU loss, first, a rectangular region needs to be created for each pair of predicted points and ground truth points Specifically, by extending the length of each line segment and expanding it vertically to obtain the width of the rectangle, the long side of the rectangle is determined by the distance between the two points, and the width is a constant e (for example, 15 pixels). In this way, two rectangular regions are obtained, namely the predicted rectangle and the ground truth rectangle.
[0034] Next, calculate the intersection area and union area of these two rectangular regions to obtain the IoU value. To further improve the performance of the model, the Generalized IoU (GLIoU) further considers the distance between the two rectangles:
[0035] Finally, the generalized IoU loss is represented by the following formula:
[0036] L GLIoU = 1 - GLIoU
[0037] By introducing the GLIoU loss, the present invention effectively optimizes the continuity and smoothness of lane line regression, making the prediction of lane lines more natural and accurate in complex scenarios and avoiding shape errors that may occur when simply relying on point-to-point matching.
[0038] Finally, the composite loss function combines these two losses, and the final total loss function is:[[]]END]]
[0039] L total = α·L GLIoU + (1 - α)L angle
[0040] where α is a hyperparameter used to balance the weights of the two losses.
[0041] Furthermore, the implementation process of step (5) is as follows:
[0042] First, after being processed by the global feature extraction module (GEM) and the top-level auxiliary module (TLAM), the model obtains the predicted position coordinates of the lane lines. Then, the predicted lane line coordinates are compared with the actual true lane line position coordinates. To measure the accuracy of the prediction results, a composite loss function is adopted, which combines the angle loss and the generalized line IoU loss. The angle loss is used to constrain the difference between the angle of the predicted lane line shape and the actual lane line, ensuring that the curvature of the lane line is as consistent with the actual situation as possible; while the generalized line IoU loss optimizes the continuity and shape of the lane line by calculating the overlapping area between the predicted lane line and the true lane line.
[0043] After substituting the predicted coordinates and the true coordinates into the above loss function to calculate the loss value, the backpropagation algorithm optimizes the parameters in the network according to the loss. This process continuously adjusts the model parameters, making the predicted lane line coordinates gradually approach the true lane line position, thereby improving the accuracy and stability of lane line detection.
[0044] By introducing the global semantic enhancement network (GSENet) and the composite loss function, the present invention significantly improves the accuracy and robustness of lane line detection in complex environments and has the following main beneficial effects:
[0045] (1) Through the introduction of the Global Feature Extraction Module (GEM), the model can effectively extract and enhance the global semantic information in images. Especially in complex scenarios such as occlusion, curves, and low illumination, it can maintain a high detection accuracy. GEM ensures the integrity of global information through multi-level feature extraction, enabling the model to show strong adaptability in various driving scenarios.
[0046] (2) The design of the Top-level Auxiliary Module (TLAM) optimizes the transmission of global semantic information through the self-attention mechanism, further improving the accuracy of lane line classification and regression. The self-attention mechanism enables the model to dynamically adjust the attention between different regions. Especially when the lane lines are curved, occluded, or in a complex background, TLAM can effectively capture the key features, thereby improving the prediction accuracy of lane lines.
[0047] (3) In terms of the design of the loss function, the composite loss function combines the Angle Loss and the Generalized Line IoU Loss (GLIoU Loss), which makes the shape and position regression of lane lines more accurate. The Angle Loss effectively optimizes the direction of lane lines, ensuring that the angle difference between the predicted lane lines and the actual lane lines is minimized; while the Generalized Line IoU Loss improves the smoothness and continuity of lane line regression by considering the geometric shape of lane lines, avoiding discontinuous or unnatural prediction results.
[0048] (4) The method of the present invention has significantly improved the performance of lane line detection in harsh environments through the optimization of the composite loss function. Whether it is a complex urban road or there are situations such as light changes, occlusion, and curves, the present invention can provide accurate and stable lane line detection results, with strong robustness and the ability to adapt to different driving scenarios. Brief Description of the Drawings
[0049] Figure 1 is the flow chart of the present invention
[0050] Figure 2 is the overall structure diagram of the network system
[0051] Figure 3 is the propagation of the feature map from the backbone network to two branches Detailed Embodiments
[0052] The present invention will be further described below with reference to the accompanying drawings.
[0053] The present invention provides a lane line detection method based on a Global Semantic Enhancement Network (GSENet), aiming to solve the limitations of existing lane line detection technologies in complex scenarios, especially the problem that traditional methods are difficult to accurately detect lane lines in environments such as bad weather, occlusion, and curves. By combining global semantic information with local features, the present invention can effectively improve the detection accuracy of lane lines in these complex environments, and while maintaining a high inference speed, optimize the model performance. The overall flow chart is as Figure 1 shown. The specific steps are as follows:
[0054] Step 1: Preprocess the images containing lane lines, including operations such as image normalization and enhancement, to ensure the quality and diversity of the input data and complete the production of the dataset.
[0055] The input image is first normalized, and the calculation formula is:
[0056]
[0057] where μ and σ are the mean and standard deviation of the dataset respectively. Subsequently, data augmentation is performed using random affine transformations (including translation, rotation, and scaling) and horizontal flipping, and the augmentation formula is:
[0058] I aug =Affine(I norm ,θ trans ,θ rotate ,θ scale )
[0059] where θ trans 、θ rotate 、θ scale are the random parameters of translation, rotation, and scaling respectively. Through the above processing, the input image size is unified to 800×320 pixels to ensure the stability and generalization ability of model training.
[0060] Step 2: Introduce a new Global Feature Extraction Module (GEM) after the backbone network (such as ResNet) of the existing lane line detection model.
[0061] The Global Feature Extraction Module (GEM) is a crucial part of the present invention and is used to capture the global semantic information in the input image. The GEM module processes and optimizes the features through two branches, namely coarse-grained global feature extraction and fine-grained global feature extraction. First, the top-level feature map output by the backbone network (such as ResNet) is input into the MLP-Mixer branch after channel scaling and normalization. MLP-Mixer extracts coarse-grained global features through cross-channel and cross-space fully connected layer interactions. These coarse-grained features provide a basic understanding and positioning of lane lines in a large range.
[0062] F coarse = MLP-Mixer(LayerNorm(F top ))
[0063] Secondly, to further improve the accuracy of global semantics, the GEM module adopts dilated convolution, which expands the receptive field and can capture more extensive context information. By setting the convolution kernel with a dilation rate d = 3, the scope of the convolution operation is extended, ensuring that the network can capture long-range dependencies. Especially in the case where the lane lines are curved or occluded, this long-range dependence is crucial. Subsequently, through the multi-head self-attention mechanism, the GEM module further enhances the capture of similarities between different regions. Under this mechanism, the feature map is divided into multiple sub-blocks, and each sub-block calculates its similarity with other regions through multi-head attention, thereby obtaining fine-grained global features. To complement the deficiencies of dilated convolution and multi-head attention mechanism in capturing spatial features,
[0064] F fine = MultiHead(DilatedConv(F top , d = 3))
[0065] The present invention also introduces the SimAm module to enhance the attention ability in 3D space. Through its parameter-free design, the SimAm module further enhances the accuracy of feature expression:
[0066]
[0067] Finally, the coarse-grained and fine-grained features are synthesized through weighted fusion to generate the final global feature representation. This fusion process ensures that the network can utilize both the breadth of coarse-grained information and the precision of fine-grained information, thereby providing comprehensive feature support for subsequent lane line detection tasks.
[0068] F global = α·F coarse +(1 - α)F fine
[0069] where α = 0.6 is the fusion weight.
[0070] Step 3: Introduce the top-level auxiliary module (TLAM) to further process the global feature map obtained from the GEM module.
[0071] The Top-level Auxiliary Module (TLAM) further optimizes the global features to improve the accuracy and robustness of lane detection. The core of the TLAM module is to enhance the feature representation ability through the self-attention mechanism, so as to better capture the shape and position information of the lane lines.
[0072] In the TLAM module, first, the global features output by the GEM module are enhanced by residual connection. This process obtains the residual features through convolution operations on the feature map, and then adds them to the original feature map to enhance the expression ability of the feature information.
[0073] F res = F global Conv(F global )
[0074] Next, the feature map is fed into the self-attention calculation module. The self-attention mechanism dynamically adjusts the weights of each region by calculating the relationships between each element in the input feature map and other elements, enabling the network to automatically focus on the key regions in the image, which is particularly important for lane detection, especially in complex scenarios where lane lines may be occluded or curved.
[0075] Q = F res W Q , K = F res W K , V = F res W V
[0076]
[0077] To further optimize the self-attention calculation process, the present invention introduces the DropKey mechanism. This mechanism reduces the computational amount and prevents overfitting by randomly masking some elements in the attention weight matrix. The DropKey mask ratio is set to 15%. In this way, the TLAM module not only improves the training efficiency of the model but also avoids over-focusing on unimportant information, thus enhancing the stability of lane detection.
[0078] Mask = Bernoulli(p = 0.85), Attention masked = Attention ⊙ Mask
[0079] Finally, the optimized features are fed into the classification and regression heads of the lane lines for final prediction. The classification head is responsible for determining whether each pixel belongs to a lane line, while the regression head is responsible for accurately predicting the position coordinates of the lane line. Through feature distillation, this process enables the global semantic information to directly affect the lane detection results and improves the accuracy of the final output.
[0080] Step 4: Design a composite loss function that combines Angle Loss and Generalized Line IoU Loss (GLIoULoss) to optimize the prediction accuracy of the lane line shape and angle.
[0081] The design of the composite loss function is another important innovation in the present invention. In order to accurately optimize the position and shape of the lane line during the training process, the present invention combines Angle Loss and Generalized Line IoU Loss (GLIoULoss) to finely constrain the angle and shape of the lane line.
[0082] The Angle Loss ensures that the direction of the lane line is consistent with the actual situation by calculating the average angular deviation between the predicted lane line and the ground truth lane line. On each lane line segment, the angular difference between the predicted point and the actual point is calculated and weighted and summed, and finally the Angle Loss of the entire lane line is obtained. By minimizing this Angle Loss, the model can accurately adjust the shape of the lane line. Especially in the case where the lane line is curved, the Angle Loss plays an important role.
[0083] First, the Angle Loss is used to constrain the angular difference between the shape of the predicted lane line and the actual lane line. In actual detection, the lane line is usually composed of a number of continuous points, and the angular difference between these points is crucial for the accurate representation of the lane line. Therefore, the Angle Loss calculates the angular difference between each short segment of the predicted lane line and the corresponding segment of the actual lane line. Specifically, for the predicted point and its previous point as well as the ground truth point and its previous point calculate the included angle θ between the predicted segment and the ground truth segment i :
[0084]
[0085] Then, by taking the average of the angular differences between all predicted segments and ground truth segments, the overall angular difference of the lane line is obtained:
[0086]
[0087] The final Angle Loss is calculated by the following formula:
[0088] L angle = 1 - cos(θ)
[0089] The design of this Angle Loss can ensure that when the model predicts the lane line, it minimizes the angular difference from the ground truth lane line as much as possible, so that the shape of the predicted lane line is closer to the actual lane line. Especially in complex situations such as curves, it can greatly improve the prediction accuracy.
[0090] Secondly, the Generalized Line IoU Loss (GLIoU Loss) is another core innovation of the present invention. Different from the traditional IoU (Intersection over Union) loss, GLIoU considers the geometric relationship between points by expanding each predicted point and its corresponding ground truth point into rectangles, thus providing a smoother and continuous lane line regression result. To calculate the GLIoU loss, first, for each pair of predicted points and ground truth points a rectangular region is created. Specifically, the width of the rectangle is obtained by extending the length of each line segment and expanding it vertically. The long side of the rectangle is determined by the distance between the two points, and the width is a constant e (e.g., 15 pixels). In this way, two rectangular regions are obtained, namely the predicted rectangle and the ground truth rectangle.
[0091] Next, the intersection area and union area of these two rectangular regions are calculated to obtain the IoU value. To further improve the performance of the model, the Generalized IoU (GLIoU) further considers the distance between the two rectangles:
[0092]
[0093] where S bound is obtained by calculating the area of the rectangle, representing the total area of the rectangle, while and are the areas of the predicted rectangle and the ground truth rectangle respectively.
[0094] In fact, GLIoU can be regarded as a combination of GIoU for a finite set of points, and then the GLIoU loss can be calculated as:
[0095]
[0096] Finally, the Generalized IoU loss is represented by the following formula:
[0097] L GLIoU = 1 - GLIoU
[0098] By introducing the GLIoU loss, the present invention effectively optimizes the continuity and smoothness of lane line regression, making the prediction of lane lines more natural and accurate in complex scenarios, and avoiding the shape errors that may occur when simply relying on point-to-point matching.
[0099] Finally, the composite loss function combines these two losses, and the final total loss function is:
[0100] L total = α·L GLIoU + (1)L angle
[0101] Among them, α is a hyperparameter used to balance the weights of the two losses. By adjusting α, the performance of lane detection can be optimized according to specific application scenarios. In the experiments of the present invention, α is set to 0.98 to strengthen the optimization of the GLIoU loss for lane shape regression while ensuring the effectiveness of the angle loss.
[0102] Step 5: Substitute the predicted lane position coordinates and the ground truth into the composite loss function, calculate the result and then perform backpropagation to complete the model training.
[0103] The present invention adopts the AdamW optimizer, sets the initial learning rate to 6e-4 (CULane dataset) and 1e-3 (TuSimple dataset), and conducts training on an NVIDIA RTX 4090 GPU. After each round of training, the best-performing weights in the model are saved to ensure that the finally obtained model has the best performance. In the inference stage, the input image is preprocessed and then input into the trained GSENet model. After being processed by the model, the coordinates of the lane lines are output. The real-time frame rate of the model can reach 45 frames per second, with high real-time performance and the ability to adapt to the lane detection requirements in actual driving scenarios.
[0104] Through the above implementation, the lane detection accuracy of the present invention in complex scenarios is significantly improved. Compared with the existing models, F1@50 is increased by 15%, and the inference efficiency is optimized, with strong practical value and broad application prospects.
Claims
1. A lane detection network system and method based on global semantic enhancement, characterized in that: The following steps are involved: (1) Preprocess the images containing lane lines to complete the preparation of the data set; (2) A new global feature extraction module (GEM) is introduced after the backbone network (such as ResNet) of the existing lane detection model; (3) Introduce the top-level auxiliary module (TLAM) to further process the global feature map obtained from the GEM module; (4) Design a composite loss function by combining angle loss (Angle Loss) and generalized line IoU loss (GLIoU Loss); (5) Substitute the predicted lane line position coordinates and the true value into the composite loss function, calculate the results, and perform back propagation to complete the model training.
2. The lane line detection network system and method based on global semantic enhancement according to claim 1 is characterized in that: The implementation process of step (1) is as follows: The images containing lane lines are preprocessed, including image normalization, enhancement, affine transformation, and horizontal flipping. The input image size is unified to 800×320 pixels to ensure the stability and generalization ability of model training.
3. The lane line detection network system and method based on global semantic enhancement according to claim 1 is characterized in that: The implementation process of step (2) of introducing a new global feature extraction module (GEM) after the backbone network (such as ResNet) of the existing lane detection model is as follows: The GEM module processes and optimizes features through two branches, namely coarse-grained global feature extraction and fine-grained global feature extraction. First, the top-level feature map output by the backbone network (such as ResNet) is channel-scaled and normalized and then input into the MLP-Mixer branch. MLP-Mixer extracts coarse-grained global features through cross-channel and cross-space fully connected layer interactions. These coarse-grained features provide a basic understanding and positioning of lane lines in a large range. F coarse =MLP-Mixer(LayerNorm(F top )) Secondly, in order to further improve the accuracy of global semantics, the GEM module uses dilated convolution to expand the receptive field and capture a wider range of contextual information. By setting the convolution kernel with a dilation rate of d = 3, the range of the convolution operation is expanded, ensuring that the network can capture long-distance dependencies, especially when the lane lines are curved or occluded. This long-distance dependency is crucial. Subsequently, through the multi-head self-attention mechanism (MultiHead Attention), the GEM module further strengthens the capture of similarities between different regions. Under this mechanism, the feature map is divided into multiple sub-blocks, and each sub-block calculates its similarity with other regions through multi-head attention to obtain fine-grained global features. In order to make up for the shortcomings of dilated convolution and multi-head attention mechanisms in capturing spatial features, F fine =MultiHead(DilatedConv(F top ,d=3)) The present invention also introduces the SimAm module to enhance the attention ability of 3D space. SimAm further enhances the accuracy of feature expression through its parameter-free design: Finally, the coarse-grained and fine-grained features are synthesized through weighted fusion to generate the final global feature representation. This fusion process ensures that the network can simultaneously utilize the breadth of coarse-grained information and the accuracy of fine-grained information, thereby providing comprehensive feature support for subsequent lane detection tasks. F global =α·F coarse +(1)·F fine Among them, α=0.6 is the fusion weight.
4. The lane line detection network system and method based on global semantic enhancement according to claim 1 is characterized in that: The step (3) introduces the top-level auxiliary module (TLAM) to further process the global feature map obtained from the GEM module. The implementation process is as follows: In the TLAM module, the global features output by the GEM module are first enhanced by residual connections. This process performs convolution operations on the feature map to obtain residual features, which are then added to the original feature map to enhance the expressiveness of feature information. F res =F global +Conv(F global ) Next, the feature map is fed into the self-attention calculation module. The self-attention mechanism dynamically adjusts the weight of each region by calculating the relationship between each element in the input feature map and other elements, so that the network can automatically focus on the key areas in the image, which is particularly important for lane line detection, especially in complex scenes where lane lines may be occluded or curved. Q=F res W Q ,K=F res W K ,V=F res W V To further optimize the self-attention calculation process, the present invention introduces the DropKey mechanism. This mechanism reduces the amount of calculation and prevents overfitting by randomly masking some elements in the attention weight matrix. The DropKey mask ratio is set to 15%. In this way, the TLAM module not only improves the training efficiency of the model, but also avoids excessive attention to unimportant information, thereby enhancing the stability of lane line detection. Mask=Bernoulli(p=0.85),Attention masked =Attention⊙Mask Finally, the optimized features are sent to the lane line classification and regression head for final prediction. The classification head is responsible for determining whether each pixel belongs to the lane line, while the regression head is responsible for accurately predicting the location coordinates of the lane line. This process uses feature distillation to allow global semantic information to directly affect the lane line detection results, improving the accuracy of the final output.
5. The lane line detection network system and method based on global semantic enhancement according to claim 1 is characterized in that: The implementation process of the composite loss function in step (4) is as follows: The present invention combines angle loss (Angle Loss) and generalized line IoU loss (GLIoU Loss) to finely constrain the angle and shape of lane lines. The angle loss ensures that the direction of the lane line is consistent with the actual situation by calculating the average angle deviation between the predicted lane line and the actual lane line. On each lane line segment, the angle difference between the predicted point and the actual point is calculated and weighted summed to finally get the angle loss of the entire lane line. By minimizing this angle loss, the model can accurately adjust the shape of the lane line, especially when the lane line is curved, the angle loss plays an important role. First, the angle loss is used to constrain the angle difference between the shape of the predicted lane line and the actual lane line. In actual detection, the lane line is usually composed of several continuous points, and the angle difference between these points is crucial for the accurate representation of the lane line. Therefore, the angle loss calculates the angle difference between each short segment of the predicted lane line and the corresponding segment of the actual lane line. Specifically, for the predicted point The previous point And the truth The previous point Calculate the angle θ between the predicted line segment and the true line segment i : Then, by taking the average of the angle differences between all predicted segments and the true segments, the angle difference of the entire lane line is obtained: The final angle loss is calculated by the following formula: L angle =1-cos(θ) The design of this angle loss can ensure that the model can minimize the angle difference with the actual lane line when predicting the lane line, so that the predicted lane line shape is closer to the actual lane line, especially in complex situations such as curves, which can greatly improve the prediction accuracy. Secondly, the generalized line IoU loss (GLIoU Loss) is another core innovation of the present invention. Different from the traditional IoU (Intersection over Union) loss, GLIoU considers the geometric relationship between points by expanding each predicted point and its corresponding real point into a rectangle, thus providing a smoother and more continuous lane regression result. In order to calculate the GLIoU loss, we first need to calculate the lane regression result for each pair of predicted points. And be real Create a rectangular region. Specifically, the width of the rectangle is obtained by extending the length of each line segment and extending it in the vertical direction. The long side of the rectangle is determined by the distance between the two points, and the width is a constant e (for example, 15 pixels). In this way, two rectangular regions are obtained, namely the predicted rectangle and the real rectangle. Next, the intersection area and union area of the two rectangular areas are calculated to get the IoU value. In order to further improve the performance of the model, the generalized IoU (GLIoU) further considers the distance between the two rectangles: Among them, S bound is obtained by calculating the area of the rectangle, which represents the total area of the rectangle, and and are the areas of the predicted rectangle and the true rectangle respectively. In fact, GLIoU can be viewed as a combination of GIoU for a finite set of points, and then the GLIoU loss can be calculated as: Finally, the generalized IoU loss is expressed as follows: L GLIoU =1-GLIoU By introducing the GLIoU loss, the present invention effectively optimizes the continuity and smoothness of lane line regression, making the prediction of lane lines in complex scenes more natural and accurate, and avoiding the shape errors that may occur when relying solely on point-to-point matching. Finally, the composite loss function combines these two losses, and the final total loss function is: L total =α·L GLIoU +(1-a)·L angle Among them, α is a hyperparameter used to balance the weights of the two losses. By adjusting α, the performance of lane detection can be optimized according to the specific application scenario. In the experiment of the present invention, α is set to 0.98 to ensure that the angle loss is effective while strengthening the optimization of the GLIoU loss for lane shape regression.
6. The lane line detection network system and method based on global semantic enhancement according to claim 1 is characterized in that: The implementation process of step (5) is as follows: The present invention uses the AdamW optimizer, sets the initial learning rate to 6e-4 (CULane dataset) and 1e-3 (TuSimple dataset), and performs training on an NVIDIA RTX 4090 GPU. After each round of training, the best performing weights in the model are saved to ensure that the final model has the best performance. In the inference stage, the input image is preprocessed and then input into the trained GSENet model. After being processed by the model, the coordinates of the lane lines are output. The real-time frame rate of the model can reach 45 frames per second, which has high real-time performance and can meet the lane line detection requirements in actual driving scenarios.
Citation Information
Cited By
Lightweight lane line detection method in automatic driving scene
CN121121682A
Lightweight lane line detection method in autonomous driving scenario
CN121121682B