A lane line detection method and system based on horizontal continuous feature enhancement

CN122929527APending Publication Date: 2026-10-16HANGZHOU DIANZI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611021287.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-09
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0013]本发明的目的在于提供一种基于水平连续特征增强的车道线检测方法及系统,从而系统性地解决现有车道线检测方法在跨场景泛化能力、细长结构连续性、类别不平衡学习及输出结果可用性等方面存在的技术瓶颈

Benefits of technology

[0029]1. This invention addresses the problem of insufficient modeling of the slender geometric structure of lane lines. It introduces a horizontal continuity feature enhancement module into the lane line detection model. This module enhances the continuous feature representation of the slender lane line structure through spatial enhancement branches, channel attention branches, dynamic convolution modules, and residual connections, thereby improving long-distance continuity. Simultaneously, this invention also introduces a positional attention module into the lane line detection model, which enhances spatial localization capabilities during the neck network feature fusion stage. These two modules work together to solve the problems of lane line segmentation breaks and localization errors. Compared to the original baseline model, the proposed solution improves mAP50-95 from 0.762 to 0.820, recall from 0.875 to 0.940, and precision from 0.918 to 0.950.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122929527A_ABST
    Figure CN122929527A_ABST
Patent Text Reader

Abstract

The application discloses a lane line detection method and system based on horizontal continuous feature enhancement. The lane line detection method obtains a measured road image, inputs the road image into a lane line segmentation model based on YOLOv8n-seg, obtains a lane line segmentation mask, and generates a detection result. The lane line segmentation model is embedded with a horizontal continuous feature enhancement module and a position attention module. The horizontal continuous feature enhancement module is used to enhance the continuous feature expression of the lane line along the main extension direction. The position attention module is used to strengthen the spatial positioning ability of the lane line region, so as to reduce the false detection of lane line fracture, boundary offset and line interference. The lane line segmentation mask is further optimized through post-processing. The post-processing optimization includes one or more of morphological closing operation, noise filtering based on contour length and multi-frame voting. The application can improve the continuity, accuracy and robustness of lane line detection in complex road scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer vision technology, specifically relating to a lane line detection method and system based on horizontal continuous feature enhancement. Background Technology

[0002] Lane detection technology, as a core technology in intelligent driving vision perception systems, aims to identify the position and shape of lane lines in real time and accurately from road images or video sequences captured by onboard cameras, providing decision-making basis for key functions such as lane keeping, lane departure warning, and automatic steering.

[0003] Currently, deep learning-based lane detection methods have made some progress on publicly available datasets. However, existing technologies still have the following shortcomings:

[0004] (1) Limited ability to generalize scenarios.

[0005] Existing models are typically trained only on a single scene dataset (such as the TuSimple dataset for highway scenes or the CULane dataset for urban road scenes), resulting in the learned feature distribution being strongly correlated with a specific scene, leading to a significant decrease in detection accuracy when applied across different scenes.

[0006] (2) Insufficient modeling of the slender geometry of lane lines.

[0007] Lane lines in images appear as elongated structures that extend horizontally and narrow vertically. The square convolutional kernels of standard convolutional neural networks struggle to balance horizontal continuity with vertical noise suppression in their receptive field design, easily leading to fragmented segmentation results or positioning errors.

[0008] (3) The foreground-background categories are extremely unbalanced.

[0009] The ratio of lane line pixels to background pixels is often as high as 1:50 or more. Under such data distribution, the conventional cross-entropy loss function is easily dominated by a large number of simple background pixels, resulting in insufficient learning of difficult samples such as occlusion and wear.

[0010] (4) The post-processing process is not targeted enough.

[0011] Existing methods often employ general morphological operations for segmentation masks of network outputs, which makes it difficult to effectively distinguish between real lane line breaks and isolated regions generated by noise, and the output results are difficult to use directly in downstream control modules.

[0012] Therefore, there is an urgent need in this field for a lane detection method that can simultaneously improve cross-scene generalization ability, elongated structure continuity, class imbalance learning effect, and output usability. Summary of the Invention

[0013] The purpose of this invention is to provide a lane detection method and system based on horizontal continuous feature enhancement, thereby systematically solving the technical bottlenecks of existing lane detection methods in terms of cross-scene generalization ability, continuity of slender structures, class imbalance learning, and usability of output results.

[0014] In a first aspect, the present invention provides a lane line detection method based on horizontal continuous feature enhancement, the method comprising:

[0015] Acquire the image of the road to be tested; input the image of the road to be tested into the lane line segmentation model to obtain the lane line segmentation mask, and obtain the lane line detection result based on the lane line segmentation mask;

[0016] The lane segmentation model uses the YOLOv8n-seg model as the baseline model and embeds a horizontal continuous feature enhancement module in the baseline model; the horizontal continuous feature enhancement module is set before the fast spatial pyramid pooling module; the horizontal continuous feature enhancement module includes a first branch, a second branch, and a fusion branch;

[0017] In the first branch, convolutional layers and depthwise convolutional modules are used sequentially to process the input feature map of the horizontal continuous feature enhancement module to obtain the spatial enhanced feature map. In the second branch, global average pooling and convolutional layers are used sequentially to process the input feature map of the horizontal continuous feature enhancement module to obtain the channel attention feature map. In the fusion branch, the spatial enhanced feature map and the channel attention feature map are multiplied element-wise to obtain the attention fusion feature map. The attention fusion feature map is then processed using a dynamic convolutional module to obtain the dynamic convolutional enhanced feature map. Finally, the dynamic convolutional enhanced feature map is added to the input feature map through residual connections to obtain the output feature map of the horizontal continuous feature enhancement module.

[0018] Preferably, the lane segmentation model also incorporates a position attention module; the position attention module is set before the first round of C2f module processing in the neck network.

[0019] Preferably, in the position attention module, global average pooling is performed on the input feature map along the height and width directions respectively to obtain height-oriented pooling features and width-oriented pooling features; the height-oriented pooling features and width-oriented pooling features are concatenated and then subjected to convolution transformation to obtain intermediate encoded features; the intermediate encoded features are split and height-oriented attention weights and width-oriented attention weights are generated respectively, and the height-oriented attention weights and width-oriented attention weights are multiplied with the input feature map to obtain the position enhancement feature map.

[0020] Preferably, the lane line segmentation model is trained using a cross-scenario joint training dataset.

[0021] Preferably, when training the lane line segmentation model, data augmentation operations are simultaneously applied to the training images and their corresponding annotations in the cross-scene joint training dataset; the data augmentation operations include one or more of the following: Mosaic enhancement, Mixup enhancement, horizontal flipping, simulated curves, translation and scaling, perspective transformation, color space perturbation, and random erasure.

[0022] As a preferred approach, when training the lane segmentation model, a total loss function including the full intersection-over-union loss function, cross-entropy loss, focus loss function, and Dice loss function is used to update the model parameters.

[0023] Preferably, when obtaining lane detection results based on lane segmentation masks, morphological closing operations are performed on the lane segmentation masks. The morphological closing operations include first performing a dilation operation on the lane segmentation masks, and then performing an erosion operation on the dilated lane segmentation masks to obtain the closing operation mask.

[0024] Preferably, the closing operation mask is subjected to contour filtering processing; the contour filtering processing includes extracting the contours of the external connected regions in the closing operation mask, calculating the curve length of each external connected region contour, and setting the connected regions with curve lengths less than a preset length threshold as the background.

[0025] Preferably, when the road image being tested is an image in a video frame sequence, the lane line segmentation mask corresponding to the current frame and the lane line segmentation mask corresponding to the historical frames are combined to form a mask queue, and the corresponding pixel positions or connected regions in the mask queue are voted on in multiple frames; when the number of times the corresponding pixel position or connected region appears in the mask queue reaches a preset voting threshold, it is retained as a lane line region.

[0026] Secondly, the present invention provides a lane detection system based on horizontal continuous feature enhancement, which is used to perform the lane detection method described above; the lane detection system includes an image acquisition module, a lane segmentation module, and a detection result acquisition module;

[0027] The image acquisition module is used to acquire the image of the road under test; the lane line segmentation module is used to input the image of the road under test into the lane line segmentation model to obtain the lane line segmentation mask; the detection result acquisition module is used to obtain the lane line detection result based on the lane line segmentation mask.

[0028] The beneficial effects of this invention are:

[0029] 1. This invention addresses the problem of insufficient modeling of the slender geometric structure of lane lines. It introduces a horizontal continuity feature enhancement module into the lane line detection model. This module enhances the continuous feature representation of the slender lane line structure through spatial enhancement branches, channel attention branches, dynamic convolution modules, and residual connections, thereby improving long-distance continuity. Simultaneously, this invention also introduces a positional attention module into the lane line detection model, which enhances spatial localization capabilities during the neck network feature fusion stage. These two modules work together to solve the problems of lane line segmentation breaks and localization errors. Compared to the original baseline model, the proposed solution improves mAP50-95 from 0.762 to 0.820, recall from 0.875 to 0.940, and precision from 0.918 to 0.950.

[0030] 2. This invention addresses the problem of insufficient targeting in post-processing workflows by repairing breaks through morphological closing operations, removing isolated pseudo-regions through contour length-based noise filtering, and suppressing single-frame jitter and missed detections through multi-frame voting. This forms a dedicated post-processing closed loop that addresses lane line geometric continuity and video temporal stability, and the output results can be directly used in downstream driving decision-making modules.

[0031] 3. This invention addresses the problem of limited scene generalization ability by jointly training a cross-scene dataset, fusing samples from multiple scenarios such as highways and complex urban roads, enabling the model to simultaneously learn lane line morphology distributions in different road environments. Experiments show that the mAP50 of this invention reaches 0.98, which is a significant improvement compared to models trained on a single highway scene dataset.

[0032] 4. This invention addresses the problem of extreme imbalance between foreground and background categories by using a segmentation loss function that combines Focal Loss and Dice Loss. Focal Loss reduces the loss weight of easily separable background samples and focuses on difficult lane line samples, while Dice Loss directly optimizes the overlap area between the predicted mask and the real mask. Together, they solve the problem of insufficient segmentation caused by the extremely low percentage of lane line pixels (≤5%). Attached Figure Description

[0033] Figure 1 This is the overall flowchart of Embodiment 1 of the present invention.

[0034] Figure 2 This is a schematic diagram of the lane line segmentation model network structure in Embodiment 1 of the present invention.

[0035] Figure 3 This is a schematic diagram of the horizontal continuous feature enhancement module in Embodiment 1 of the present invention.

[0036] Figure 4 This is a schematic diagram of the position attention module structure in Embodiment 1 of the present invention.

[0037] Figure 5 This is a visualization of the lane line detection results in the cross-scene joint training dataset of Embodiment 1 of the present invention. Detailed Implementation

[0038] The present invention will be further described below with reference to the accompanying drawings.

[0039] like Figure 1 As shown, a lane detection method based on horizontal continuous feature enhancement includes the following steps:

[0040] Step S1: Multi-source dataset fusion and enhancement

[0041] Step S11. Dataset Acquisition and Selection Criteria

[0042] To address the limitations of generalization capabilities caused by insufficient scene coverage in single datasets, this invention selects two complementary public datasets, CULane and TuSimple, and constructs a high-quality cross-scene joint training dataset through format unification, deduplication, proportional sampling, and enhancement. The CULane dataset covers complex scenes such as urban roads, rural roads, and curves, containing approximately 130,000 images in TXT format. The images exhibit diverse resolutions, and lane line morphologies include straight lines, dashed lines, severely worn lane lines, and sharp curve lane lines. It encompasses nine scene categories: normal, no lane lines, strong lighting, shadows, arrows, curves, congestion, nighttime, and intersections. The TuSimple dataset focuses on highway scenes, containing 3,636 training images, 278 validation images, and 272 test images. The original resolution is 640×384, and the annotation format is JSON. The annotations include image filenames, lane line polygon coordinates, and corresponding ordinate sequences, covering scenes with varying lighting intensities, vehicle occlusion, and lane line wear.

[0043] Step S12. Standardize the format

[0044] For the JSON-formatted annotations in the TuSimple dataset, the JSON annotation files are traversed, and the ordinate sequence of lane lines and the corresponding abscissa sequence of each lane line are extracted from each image. Invalid coordinate points with an abscissa value of -2 are removed, and the coordinate pairs of valid lane line contours are retained. Then, based on the original resolution of the image, the valid pixel coordinates (x,y) are converted into normalized coordinates in the range [0,1]. It is represented as follows:

[0045]

[0046] Where W is the image width and H is the image height.

[0047] The TuSimple dataset has an image width W of 640 and an image height H of 384; the CULane dataset is calculated based on the actual resolution of the original image, and all coordinates are retained to 6 decimal places to ensure accuracy.

[0048] Each image corresponds to a TXT annotation file, with the filename being the same as the image filename. Each lane line annotation occupies one line in the file. The first column is the category identifier "0", which indicates the lane line category. The following columns are the normalized coordinate points, arranged in order of the lane line extension direction.

[0049] Step S13. Scene scale sampling and sample balancing

[0050] Based on the sample size, lane line morphology complexity, and training objectives for different scenarios, effective samples are extracted from the preprocessed TuSimple and CULane datasets to construct a cross-scenario joint training sample set. This cross-scenario joint training sample set covers multiple scenarios, including highways, urban roads, and rural roads, with lane line morphologies ranging from simple straight lines to complex curves, achieving complementary scene features.

[0051] Step S14. Data Augmentation

[0052] To address the characteristics of lane lines being long, continuous, and having a pixel ratio of less than 5%, data augmentation was performed. The data augmentation strategies included horizontal flipping (0.5), Mosaic enhancement (0.3), Mixup enhancement (0.2), simulated curves (0.15), translation and scaling (0.4), perspective transformation (0.25), and random erasure (0.3). These parameters can be adjusted based on the training sample distribution and deployment scenario. The aim is to maintain the consistency of lane line morphology while enhancing the model's adaptability to occlusion, shadows, wear, and curved scenes.

[0053] All enhancement operations are applied synchronously to the image and its corresponding annotations to ensure consistency between the annotations and image features. After enhancement, the enhanced samples are randomly divided into training and validation sets in an 8:2 ratio. A dataset configuration file for the lane line segmentation model is created, specifying the dataset root directory, training and validation set paths, number of categories, and category names, providing a basis for data retrieval for model training.

[0054] Step S2: Construct the lane line segmentation model

[0055] Because lane detection models need to simultaneously meet three core requirements—high accuracy, high real-time performance, and lightweight deployment—to adapt to the engineering application requirements of intelligent driving vehicle embedded platforms, this invention conducted parallel comparative experiments on classic solutions and mainstream edge models in the current lane detection field under the same cross-scenario joint training dataset, training parameters, and hardware environment to select the optimal baseline model. The test results are shown in the table below.

[0056] Table 1 Performance Comparison of Mainstream Lane Detection Models

[0057]

[0058] Based on the comparative experimental results above, this invention ultimately selects the YOLOv8n-seg model as the baseline model. Compared to the classic lane detection model SCNN, the YOLOv8n-seg baseline model, under the same cross-scene joint training dataset and experimental conditions, improves mAP50 by 15.8 percentage points, precision by 10.8 percentage points, and recall by 7.5 percentage points, demonstrating advantages in lane target localization accuracy, complete capture capability, and resistance to background false detections. Furthermore, the YOLOv8n-seg model is more suitable for meeting the functional safety requirements of high real-time performance and low latency for detection algorithms in intelligent driving vehicle scenarios, providing excellent basic performance support for subsequent targeted structural improvements and loss function optimization.

[0059] Furthermore, the YOLOv8n-seg model adopts an end-to-end modular architecture that integrates object detection and instance segmentation, which is highly scalable. This facilitates targeted embedding of improvements such as horizontal continuous feature enhancement structures, positional attention mechanisms, and composite loss functions, maximizing the performance gains of each innovation. As a lightweight edge model, it has low hardware computing power requirements and fewer deployment restrictions, and can flexibly adapt to different in-vehicle embedded systems and software and hardware environments, thus expanding its industry application scope. It solves the industry pain points of traditional high-precision lane detection models, such as large number of parameters, high deployment difficulty, and poor hardware adaptability.

[0060] In one embodiment, the baseline model has an input image size of 640×640, a model depth factor of 0.33, and a width factor of 0.25; in a lightweight deployment scenario, it can also be configured to 512×512.

[0061] like Figure 2As shown, the lane segmentation model uses the YOLOv8n-seg model as the baseline model, embedding a Horizontal Continuous Feature Augmentation (LSKA) module and a CoordAttention module within it. The lane segmentation model consists of a backbone network, a neck network, and a head network. In the backbone network, multi-level convolutional layers (Conv) and a C2f module are used for progressive downsampling and feature extraction to form feature maps at different scales. At the end of the backbone network, a LSKA module and a fast spatial pyramid pooling (SPPF) module are connected in series to enhance the model's ability to capture horizontally extended and long-distance continuous features of lane lines, while also enabling higher-level features to contain richer contextual information. In the neck network, top-down semantic enhancement is achieved first through upsampling, feature concatenation, and a C2f module, followed by bottom-up localization information supplementation through downsampling, feature concatenation, and a C2f module, thus completing feature fusion at different scales. Furthermore, a CoordAttention module is inserted before the first round of C2f module processing in the neck network to enhance the model's fine-grained localization ability of lane line positions. The head network is used to perform target detection based on the features fused by the neck network, adapting to the detection needs of small, medium and large targets respectively.

[0062] like Figure 3 As shown, the horizontal continuous feature enhancement module includes a first branch, a second branch, and a fusion branch. In the first branch, a 1×1 convolutional layer and a 5×5 depthwise convolutional module are used sequentially to process the input feature map X of the horizontal continuous feature enhancement module to obtain the spatial enhanced feature map. In the second branch, global average pooling (GAP) and a 1×1 convolutional layer are used sequentially to process the input feature map X of the horizontal continuous feature enhancement module to obtain the channel attention feature map. In the fusion branch, spatially enhanced feature maps are... With channel attention feature map Element-wise multiplication is performed to obtain the attention fusion feature map. Use a dynamic convolution module (Dynamic Conv) to fuse feature maps for attention. The process is performed to obtain a dynamically convolutionally enhanced feature map. Enhance feature maps through dynamic convolution using residual connections. Adding the input feature map X to the output feature map of the horizontal continuous feature enhancement module yields the output feature map. .

[0063] like Figure 4 As shown, in the position attention module, the input feature map is processed respectively. Global average pooling is performed along the height and width directions to obtain the height-oriented pooling feature. and width-direction pooling features ; Pooling features along the height direction and width-direction pooling features The intermediate encoded features are obtained by concatenating along the channel dimension and then performing channel compression and feature transformation through a 1×1 convolutional layer and a ReLU activation function. The convolutional layer has C / 8 (128) output channels, which compresses the channel dimension to reduce computation; intermediate encoded features are used to... The feature is obtained by splitting the data along the height and width directions. and width direction features The height-direction features are processed by two independent convolutional blocks (each convolutional layer has C output channels, i.e., 1024). and width direction features Channel restoration and weight generation are performed to obtain the height-oriented attention weights. Attention weights in width direction ; Weight the height direction attention Attention weights in the width direction and input feature map Element-wise multiplication yields the location-enhanced feature map output by the location attention module. The above process can be expressed by the following formula:

[0064]

[0065]

[0066]

[0067]

[0068]

[0069] in, The pooling feature is the h-th row in the height direction; The pooling feature is the w-th column in the width direction; Input feature map The element in row h and column w; and These are the input feature maps. Width and height; Represents the ReLU activation function; This is the Sigmoid activation function.

[0070] Step S3, Model Training

[0071] The lane segmentation model is trained using a training set. To address class imbalance and segmentation fragmentation caused by the low pixel ratio of lane lines, a total loss function is designed to guide model training, including the perfect intersection-over-union loss function, cross-entropy loss, focus loss function, and Dice loss function. The expression for the total loss function is as follows:

[0072]

[0073] in, The full intersection-union loss function; The cross-entropy loss function; For focus loss function; The Dice loss function; and To reduce the weighting coefficients of the loss function and increase its importance in the overall optimization objective, and to align with the core requirements of lane line segmentation, in this embodiment... , .

[0074] The definitions of each loss term are as follows:

[0075] (1) Complete intersection-union ratio loss function

[0076] The Complete Intersection over Union (CUI) loss function is used to optimize the localization accuracy of lane line bounding boxes. It comprehensively evaluates the distance between the center points of the bounding boxes, the aspect ratio, and the CUI. Its expression is:

[0077]

[0078] in, This is the intersection-union ratio (IoU) between the predicted bounding box and the ground truth bounding box. The Euclidean distance is the center point. The center point of the prediction box; The center point of the true bounding box; This is the length of the diagonal of the bounding box; As a balance factor; This is a parameter for aspect ratio consistency.

[0079] (2) Cross-entropy loss function

[0080] The cross-entropy loss function is used to optimize the classification accuracy of lane lines and background, and its expression is:

[0081]

[0082] in, Category labels; To predict probabilities.

[0083] (3) Focus loss function

[0084] The focus loss function is used to address the extreme imbalance between foreground lane lines and background pixels, and its expression is:

[0085]

[0086] in, For binarized real labels; To predict probabilities; The weight for positive samples is 0.25 in this embodiment; To focus on the parameters, in this embodiment, it is... .

[0087] (4) Dice loss function

[0088] The Dice loss function is used to optimize the overlap area between the predicted mask and the ground truth mask, enhancing the continuity of lane line segmentation. Its expression is:

[0089]

[0090] in, The binarized segmentation mask predicted by the model; The actual segmentation mask is generated from the annotation file. This represents the summation of all elements in the matrix; This indicates element-wise multiplication; .

[0091] During training, cosine annealing learning rate scheduling and linear preheating mechanism are used to jointly optimize model convergence. The specific parameter configuration and training process are as follows:

[0092] (1) Basic training parameters: Considering both model complexity and hardware conditions (taking NVIDIA GeForce RTX4060 GPU as an example), the batch size is set to 24; to ensure the model fully learns lane line features and avoids underfitting, the training epochs are set to 100. The input image size is set to 640×640 pixels in one embodiment, and can be set to 512×512 pixels in lightweight deployments or low-computing devices.

[0093] (2) Learning rate scheduling strategy: The initial learning rate lr0 is set to 0.005, and the final learning rate lrf is set to 0.0001. A cosine annealing scheduler is used to achieve smooth decay of the learning rate, avoiding the convergence oscillations that may be caused by traditional step decay. At the same time, a linear warmup mechanism of 5 training cycles is introduced to gradually increase the learning rate linearly from 0 to the initial learning rate lr0, so as to alleviate the risk of gradient explosion in the early stage of training and ensure that the model starts smoothly.

[0094] (3) Data loading and augmentation: During training, the training set and validation set images are read according to the instructions in the dataset configuration file data.yaml. The data augmentation operations described in 1.4 are applied in real time during the training phase to expand the sample diversity; during the validation phase, all augmentation operations are turned off, and only pixel value normalization is performed on the images to ensure the objectivity and comparability of the validation results.

[0095] (4) Forward Propagation and Loss Calculation: After the image is input into the model, it sequentially passes through the backbone network for feature extraction, Lane-LSKA horizontal continuous feature enhancement, SPPF pooling, and neck network multi-scale fusion. Position attention enhancement is performed before the first round of C2f module processing in the neck network. Finally, the lane line segmentation mask is output by the segmentation head. Based on the prediction results and the ground truth annotations, the total loss and the loss of each component are calculated, and the gradient is calculated through backpropagation to continuously update the model weights.

[0096] (5) Model saving and validation: After each training round, the model performance is evaluated on the validation set. The monitoring metrics include validation set bounding box loss (val / box_loss), precision, recall, mAP50, and mAP50-95. The current optimal model weights and the latest round weights are saved to support breakpoint training and subsequent inference applications.

[0097] The above training parameters and procedures together ensure the efficient and stable convergence of the improved model, laying the foundation for subsequent post-processing optimization and practical applications.

[0098] Step S4: Post-processing optimization

[0099] Step S41. Perform morphological closing operation on the initial mask.

[0100] The image to be tested is input into the lane line segmentation model to obtain a binary segmentation mask M. First, a 3×3 rectangular structuring element (kernel) is defined. Based on this structuring element, morphological closing operations are performed on the binary segmentation mask M: a dilation operation is performed on the binary segmentation mask M to fill small gaps and breaks in the lane line regions, ensuring the continuity of the lane line contours. Then, an erosion operation is performed on the dilated binary segmentation mask M to smooth the lane line edges and restore their approximate original width, avoiding the problem of overly thick lane line contours caused by the dilation operation. After closing operations, the closing mask M is obtained. closed .

[0101] Step S42. Extract the contours of connected components from the mask.

[0102] The contour search algorithm is used to extract the closing operation mask M. closedthe list of contour point sets of all externally connected regions in , and acquire the contour feature information corresponding to each connected region, so as to provide a basis for subsequent noise filtering.

[0103] Step S43. Filtering noise contours by length threshold

[0104] Traverse each contour point set, and calculate the curve length length corresponding to each contour through a contour perimeter calculation function. A length threshold T is preset, and the contour curve length is taken as the basis for noise judgment. Contours satisfying length<T are determined as invalid noise contours, and the connected regions corresponding thereto are set as the background in the mask using a filling function. All contour regions with a length greater than or equal to the length threshold T are retained, to obtain a filtered mask M filtered .

[0105] Step S44. Multi-frame voting and final output

[0106] In a video input scenario, the filtered mask M of the current frame filtered and the historical masks of the latest N frames together form a voting queue. For each pixel or connected region, the number of times it is determined as a lane line in the latest N frames is counted; when the occurrence count reaches a preset threshold, the region is retained, otherwise it is suppressed as the background. This can reduce the impacts of single-frame missed detection, instantaneous occlusion interference and detection boundary jitter on the output result. The binary mask obtained after the closing operation, contour length filtering and multi-frame voting is the finally optimized lane line detection result, which can be directly used for lane line visualization display, and can also be used as the input for lane line vectorization processing.

[0107] Step S5. Experimental results and verification

[0108] To verify the effectiveness and superiority of the lane line detection method proposed in the present invention, the TuSimple highway dataset, the CULane urban complex scenario dataset, and the cross-scenario joint training dataset constructed by the two are used as experimental carriers, multiple groups of comparative experiments are set up, verification is carried out from two aspects of quantitative index comparison and core improvement point contribution analysis, and the technical effect of the technical solution of the present invention is comprehensively demonstrated in combination with measured real experimental data. All experimental results are the optimal performance indexes obtained on the verification set after the model is trained to the corresponding epoch, and the visualization diagram of the lane line detection result of the cross-scenario joint training dataset is as shown in Figure 5 below.

[0109] Step S51. Experimental setup

[0110] Step S511. Evaluation indicators

[0111] Core quantitative indicators in the field of lane line segmentation and detection are selected, which take into account the positioning accuracy, completeness and comprehensive performance of the model. The specific evaluation indicators include:

[0112] (1) val / box_loss: Bounding box regression loss value. The smaller the value, the higher the accuracy of the model in locating the lane line boundary.

[0113] (2) Precision: The proportion of pixels that the model predicts as lane lines but are actually lane lines, reflecting the model's ability to resist false detections in the background;

[0114] (3) Recall: The proportion of real lane line pixels that are correctly predicted by the model, reflecting the model's ability to capture lane lines completely;

[0115] (4) mAP50: The average accuracy when the Intersection over Union (IoU) threshold is 0.5. It is the core evaluation index for lane detection tasks and comprehensively measures the detection accuracy.

[0116] (5) mAP50-95: The average accuracy of the crossover ratio threshold from 0.5 to 0.95 with a step size of 0.05, which accurately reflects the robustness of the model under different matching accuracies.

[0117] Step S512. Comparison of Scheme Design

[0118] To clarify the technical contribution of this invention in cross-scene joint training, three parallel experiments were set up, all using the lane line segmentation model of this invention, with only the training dataset changed, to ensure the fairness and effectiveness of the comparison:

[0119] Option A: Train using only the TuSimple dataset;

[0120] Option B: Train using only the CULane dataset;

[0121] Solution C (the method of this invention): Training is performed using a cross-scene joint training dataset constructed with TuSimple and CULane.

[0122] Step S513. Ablation Experiment Design

[0123] To quantitatively verify the independent contribution and synergistic effect of each core improvement point of the present invention, a single-variable controlled ablation experiment was set up. All experiments used the same cross-scenario joint training dataset, training parameters, and hardware environment, and only the core improvement modules of the present invention were added step by step. The experimental configuration is as follows:

[0124] Baseline: YOLOv8n-seg original model;

[0125] Ablation Group 1: Baseline + Location Attention Mechanism;

[0126] Ablation group 2: Baseline+Lane-LSKA horizontal continuous feature enhancement structure;

[0127] Ablation group 3: Baseline + Lane-LSKA horizontal continuous feature enhancement structure + positional attention mechanism;

[0128] Ablation group 4 (final solution of this invention): Baseline + Lane-LSKA horizontal continuous feature enhancement structure + positional attention mechanism + improved loss function;

[0129] Step S52. Comparison experiment with training on a single dataset. The evaluation metrics of each comparison scheme under different training rounds are shown in Table 2. This data is the actual result of the experiment, which objectively reflects the impact of different datasets on model performance and the technical advantages of the method of this invention.

[0130] Table 2 Evaluation metrics for models trained on different datasets

[0131]

[0132] Step S521. Comparison of training convergence characteristics

[0133] To more intuitively demonstrate the convergence performance of the models trained on different datasets, the reduction in loss function and the improvement in core metrics are summarized in Tables 3 and 4, respectively, to quantitatively compare the convergence efficiency and stability of each approach.

[0134] Table 3. Comparison of val / box_loss convergence for each scheme

[0135]

[0136] Table 3 shows that the reduction in val / box_loss of the cross-scene joint training dataset is basically the same as that of TuSimple and much higher than that of CULane, indicating that the joint training data makes the gradient update of the model more sufficient during the training process; the final loss value is only slightly higher than that of CULane and much lower than that of TuSimple, proving that the cross-scene joint training effectively balances the feature learning of different scenarios, making the model's localization accuracy close to that of the best single dataset and far exceeding that of the single highway dataset.

[0137] Table 4 Comparison of mAP50 training improvement for each scheme

[0138]

[0139] In Table 4, the cross-scene joint training dataset achieved an mAP50 of 0.96 after 10 training rounds, which is higher than CULane's 0.94 in the same round, and there was no overfitting after 100 rounds. Although TuSimple improved by 12.2%, its initial and final mAP50 were much lower than those of the joint training dataset. This indicates that the cross-scene joint training data of this invention enables the model to quickly learn high-quality cross-scene features in the early stage of training, and has excellent convergence stability.

[0140] Step S522. Final performance comparison

[0141] Table 5 summarizes the core performance metrics after training to 100 convergence (the improvement is relative to the single TuSimple dataset), providing a clear comparison of the final detection capabilities of each approach:

[0142] Table 5. Comparison of final performance of each scheme after 100 training rounds

[0143]

[0144] Table 5 clearly demonstrates that the cross-scene joint training dataset slightly improves upon CULane in terms of Precision, Recall, and mAP50 metrics, while maintaining a similar mAP50-95 to CULane. This further reduces the background false detection rate, and while ensuring robustness against false detections, it also achieves better lane line integrity, thus balancing cross-scene robustness with high accuracy.

[0145] Step S53. Ablation Experiment Analysis

[0146] This ablation experiment strictly followed the principle of univariate control. All training rounds, datasets, and hardware environments were completely consistent. The actual test results are shown in Table 6.

[0147] Table 6 Ablation Experiment Results

[0148]

[0149] As shown in Table 6, with the advancement of model improvement, the val / box-loss continuously decreases, and the model localization error continues to shrink. After adding the improved loss function, Recall increases from 0.921 to 0.940, and mAP50-95 increases from 0.808 to 0.820, with both metrics showing an improvement of over 2%.

[0150] Considering that the mAP50 of the Lane-LSKA horizontal continuous feature enhancement structure and positional attention mechanism superposition scheme is already as high as 0.971, which is in the high performance saturation range, we achieved a 0.9% improvement in mAP50 on this basis, while significantly optimizing Recall and mAP50-95, which proves that the improved loss function has a significant gain on the model's localization accuracy and generalization ability.

[0151] Step S531. Performance contribution analysis of single module improvement

[0152] As shown in Table 6, compared to the original Baseline model:

[0153] (1) After adding only the position attention mechanism, the model's mAP50 improved by 1.4 percentage points, mAP50-95 improved by 1.9 percentage points, Precision improved by 1.2 percentage points, and Recall improved by 1.8 percentage points, proving that the position attention mechanism effectively enhances the model's fine-grained localization ability of lane lines by encoding spatial position information, and reduces false detections and false negatives.

[0154] (2) After adding only the Lane-LSKA horizontal continuous feature enhancement structure, the model's mAP50 improved by 2.3 percentage points, mAP50-95 improved by 3.1 percentage points, Precision improved by 2.0 percentage points, and Recall improved by 3.2 percentage points. The performance improvement was better than that of the single-position attention mechanism, proving that the one-dimensional horizontal continuous feature aggregation design of Lane-LSKA accurately adapted to the geometric features of the lane lines being slender and horizontally extended, and greatly enhanced the model's ability to capture the continuous features of the lane lines.

[0155] (3) Both enhancement structures achieved a significant reduction in train / box_loss, proving that their addition effectively optimized the convergence effect of the model, balancing performance and engineering practicality.

[0156] Step S532. Efficiency Analysis of Dual-Module Collaboration and Loss Function Improvement

[0157] (1) After the Lane-LSKA horizontal continuous feature enhancement structure and the position attention mechanism are superimposed, the model mAP50 is improved by 3.3 percentage points compared with the baseline, and mAP50-95 is improved by 4.4 percentage points. The performance improvement exceeds the sum of the improvement of the two single structures, which proves that the two have formed a significant synergistic effect and complement each other to meet the requirements of lane line detection continuity and positioning accuracy.

[0158] (2) After superimposing the improved composite loss function, the final solution of this invention achieves a further breakthrough in performance, proving that the composite design of Focal Loss and Dice Loss effectively solves the problem of extreme imbalance between the foreground and background pixels of the lane line, while strengthening the continuity of the segmentation results. Together with Lane-LSKA, position attention mechanism and post-processing closed loop, it forms a complete technology chain, achieving a comprehensive improvement in detection accuracy, integrity and robustness.

[0159] Step S54. Experimental Conclusion

[0160] Through comparative experiments and in-depth analysis based on real measured data, the following core conclusions can be drawn:

[0161] This invention uses TuSimple and CULane to construct a cross-scene joint training dataset, which effectively solves the problem of scene limitations in training models with a single dataset. It provides the model with rich features across highways and urban roads. While retaining high detection accuracy in complex scenes, it makes up for the deficiency of insufficient adaptability in a single scene, which is an important foundation for improving the model's generalization ability and detection accuracy.

[0162] The Lane-LSKA horizontal continuous feature enhancement structure and position attention mechanism embedded in the YOLOv8n-seg model in this invention form a synergistic effect with cross-scene joint training data, which respectively enhances the ability to capture lane line horizontal features and fine-grained position localization. Combined with the Focal Loss+Dice Loss composite loss function and post-processing closed loop, the model achieves a comprehensive improvement in detection accuracy, completeness, temporal stability and robustness.

[0163] Experimental data confirms that after training for 100 rounds, the method of this invention significantly outperforms single-dataset training schemes and existing classic schemes in all core indicators. It can stably adapt to lane line detection requirements in multiple scenarios such as highways and urban roads, providing reliable environmental perception technology support for core functions such as lane keeping and automatic lane changing in intelligent driving systems.

[0164] Example 2

[0165] A lane detection system based on horizontal continuous feature enhancement is provided for performing the lane detection method in Example 1. The lane detection system includes an image acquisition module, a lane segmentation module, and a detection result acquisition module.

[0166] The image acquisition module is used to acquire images of the road under test. These images can be real-time road images captured by an onboard camera, or pre-stored road images or road video frames. After acquiring the road image, the image acquisition module performs preprocessing such as resizing and pixel normalization to ensure it meets the input requirements of the lane segmentation model. The lane segmentation module inputs the road image into the lane segmentation model to obtain the lane segmentation mask.

[0167] The detection result acquisition module is used to obtain lane line detection results based on the lane line segmentation mask. In one embodiment, the detection result acquisition module can directly output the lane line segmentation mask as the lane line detection result. In another embodiment, the detection result acquisition module can perform post-processing on the lane line segmentation mask to further improve the continuity and usability of the output results.

[0168] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A lane line detection method based on horizontal continuous feature enhancement, characterized in that: The method includes: Acquire the image of the road to be tested; input the image of the road to be tested into the lane line segmentation model to obtain the lane line segmentation mask, and obtain the lane line detection result based on the lane line segmentation mask; The lane segmentation model uses the YOLOv8n-seg model as the baseline model and embeds a horizontal continuous feature enhancement module in the baseline model; the horizontal continuous feature enhancement module is set before the fast spatial pyramid pooling module; the horizontal continuous feature enhancement module includes a first branch, a second branch, and a fusion branch; In the first branch, convolutional layers and depthwise convolutional modules are used sequentially to process the input feature map of the horizontal continuous feature enhancement module to obtain the spatial enhanced feature map. In the second branch, global average pooling and convolutional layers are used sequentially to process the input feature map of the horizontal continuous feature enhancement module to obtain the channel attention feature map. In the fusion branch, the spatial enhanced feature map and the channel attention feature map are multiplied element-wise to obtain the attention fusion feature map. The attention fusion feature map is then processed using a dynamic convolutional module to obtain the dynamic convolutional enhanced feature map. Finally, the dynamic convolutional enhanced feature map is added to the input feature map through residual connections to obtain the output feature map of the horizontal continuous feature enhancement module.

2. The lane detection method based on horizontal continuous feature enhancement according to claim 1, characterized in that: The lane line segmentation model also incorporates a position attention module; this position attention module is set before the first round of C2f module processing in the neck network.

3. The lane line detection method based on horizontal continuous feature enhancement according to claim 2, characterized in that: In the position attention module, global average pooling is performed on the input feature map along the height and width directions respectively to obtain height-oriented pooled features and width-oriented pooled features. The height-oriented pooled features and width-oriented pooled features are concatenated and then subjected to convolution transformation to obtain intermediate encoded features. The intermediate encoded features are split and height-oriented attention weights and width-oriented attention weights are generated respectively. The height-oriented attention weights and width-oriented attention weights are multiplied with the input feature map to obtain the position enhancement feature map.

4. The lane line detection method based on horizontal continuous feature enhancement according to claim 1, characterized in that: The lane line segmentation model is trained using a cross-scenario joint training dataset.

5. The lane line detection method based on horizontal continuous feature enhancement according to claim 4, characterized in that: When training the lane line segmentation model, data augmentation operations are applied synchronously to the training images and their corresponding annotations in the cross-scene joint training dataset; the data augmentation operations include one or more of the following: Mosaic enhancement, Mixup enhancement, horizontal flipping, simulated curves, translation and scaling, perspective transformation, color space perturbation, and random erasure.

6. The lane line detection method based on horizontal continuous feature enhancement according to claim 4, characterized in that: When training the lane segmentation model, the model parameters are updated using a total loss function that includes the full intersection-over-union loss function, cross-entropy loss function, focus loss function, and Dice loss function.

7. The lane line detection method based on horizontal continuous feature enhancement according to claim 1, characterized in that: When obtaining lane detection results based on lane segmentation masks, morphological closing operations are performed on the lane segmentation masks. The morphological closing operations include first performing a dilation operation on the lane segmentation masks, and then performing an erosion operation on the dilated lane segmentation masks to obtain the closing operation mask.

8. The lane line detection method based on horizontal continuous feature enhancement according to claim 7, characterized in that: The closing operation mask is subjected to contour filtering processing; the contour filtering processing includes extracting the contours of the external connected regions in the closing operation mask, calculating the curve length of each external connected region contour, and setting the connected regions with curve lengths less than a preset length threshold as the background.

9. The lane line detection method based on horizontal continuous feature enhancement according to claim 8, characterized in that: When the road image being tested is an image in a video frame sequence, the lane line segmentation mask corresponding to the current frame and the lane line segmentation mask corresponding to the historical frames are combined to form a mask queue, and the corresponding pixel positions or connected regions in the mask queue are voted on by multiple frames; when the number of times the corresponding pixel position or connected region appears in the mask queue reaches the preset voting threshold, it is retained as a lane line region.

10. A lane detection system based on horizontal continuous feature enhancement, characterized in that: The system is used to perform the lane line detection method based on horizontal continuous feature enhancement as described in claim 1; the lane line detection system includes an image acquisition module, a lane line segmentation module, and a detection result acquisition module; The image acquisition module is used to acquire the image of the road under test; the lane line segmentation module is used to input the image of the road under test into the lane line segmentation model to obtain the lane line segmentation mask; the detection result acquisition module is used to obtain the lane line detection result based on the lane line segmentation mask.