Skip to content

Repository files navigation

LaneNet: Enhanced Curved Lane Detection

Python PyTorch CUDA OpenCV Albumentations MMCV Matplotlib Scikit--learn

LaneNet is a deep learning-based label assignment module integrated into the state-of-the-art Cross Layer Refinement Network (CLRNet) for lane detection.
Unlike classical cost functions used for label assignment, LaneNet learns to match predicted lanes to ground truth dynamically, leading to improved performance on challenging curved lane scenarios while maintaining parity on standard cases.


Demo

Screenshot 2025-08-31 at 3 56 34 PM
results

Motivation

Lane detection is critical for autonomous driving and ADAS systems. Existing anchor-based models like CLRNet rely on handcrafted cost functions to assign predicted lanes to ground truths, which:

  • Operate in low-dimensional space
  • Lack flexibility in unseen scenarios
  • Struggle with curved lanes, occlusions, and lighting variations

LaneNet replaces this handcrafted label assignment step with a learned neural network, improving the model’s understanding of complex road geometries.


Key Contributions

  • Learned Label Assignment: LaneNet uses a fully connected neural network to predict match probabilities between predictions and ground truth.
  • Seamless Integration with CLRNet: LaneNet plugs into the CLRNet architecture without altering its core design.
  • Curve-Focused Training: Pretrained on a curve-specific subset of CULane to specialize in challenging geometries.
  • Performance Gains:
    • +2.8% F1 (ResNet34 backbone)
    • +2.3% F1 (ResNet101 backbone)
    • +2.96% F1 (DLA34 backbone)
  • Higher Confidence Thresholds: Improves detection confidence, enabling stricter filtering for better precision.

Project Report

For a comprehensive overview of our methodology, experiments, and results, refer to the full Project Report:

LaneNet_Final_Report.pdf

The report covers:

  • Background and motivation for LaneNet
  • Detailed explanation of CLRNet integration
  • Curve-focused dataset preparation strategy
  • Training procedure and hyperparameter choices
  • Quantitative and qualitative analysis
  • Comparison with state-of-the-art methods
  • Future work and research directions

Architecture

Screenshot 2025-08-31 at 4 01 48 PM#

Pipeline Overview:

  1. Backbone Feature Extraction

    • ResNet or DLA backbone with FPN to extract multi-scale lane features.
  2. Lane Priors & ROIGather

    • Anchor-based lane priors guide pooling of lane features.
  3. Lane Prediction Head

    • Outputs classification scores, geometric parameters, and auxiliary segmentation maps.
  4. LaneNet Matching Module

    • Predicts match probabilities for each predicted lane-ground truth pair, replacing handcrafted cost functions.

Dataset

We use the CULane dataset, a benchmark for lane detection research:

Subset Description Images
Training Standard lane images ~88K
Validation Standard lane images ~9.7K
Test Categorized into 9 scenarios (normal, crowd, dazzle, shadow, curve, etc.) ~34K
Curve Subset Focused dataset of 8,677 curved-lane images for pretraining LaneNet. 8,677

Link to the dataset - https://xingangpan.github.io/projects/CULane.html

Download CULane dataset. Then extract them to $CULANEROOT. Create a link to the data directory.

cd $CLRMATCHNET_ROOT
mkdir -p data
ln -s $CULANEROOT data/CULane

File Structure

$CULANEROOT/driver_xx_xxframe    # data folders x6
$CULANEROOT/laneseg_label_w16    # lane segmentation labels
$CULANEROOT/list                 # data lists

Results

Backbone Model Curve F1 Δ Improvement
ResNet34 CLRNet 72.77 -
CLRLaneNet 75.57 +2.8%
ResNet101 CLRNet 75.57 -
CLRLaneNet 77.87 +2.3%
DLA34 CLRNet 74.13 -
CLRLaneNet 77.09 +2.96%

Installation

Clone the repository and install dependencies:

git clone https://github.com/<your-username>/LaneNet.git
cd LaneNet

# Create a virtual environment
python3 -m venv venv
source venv/bin/activate

# Install requirements
pip install --upgrade pip
pip install -r requirements.txt

Training

# Pretrain LaneNet on curve subset
python train_lanenet.py --config configs/lanenet_curve.yaml

# Fine-tune CLRNet + LaneNet integration
python train_clrlanenet.py --config configs/clrlanenet.yaml

Evaluation

python evaluate.py --config configs/clrlanenet.yaml --weights <checkpoint_path>

Validation

python main.py [configs/path_to_your_config] --[test|validate|demo] --load_from [path_to_clrmatchnet_model] --gpus [gpu_num]

For example, run:

python main.py configs/clrnet/clr_dla34_culane.py --test --load_from=culane_dla34.pth --gpus=1

This code can output the visualization result when testing, add --view. We will get the visualization result in work_dirs/xxx/xxx/xxx/visualization

Demo

python main.py [configs/path_to_your_config] --demo --load_from [path_to_clrmatchnet_model] --gpus [gpu_num] --view

References

  1. X. Pan, J. Shi, P. Luo, X. Wang, and X. Tang. Spatial as Deep: Spatial CNN for Traffic Scene Understanding. In Proceedings of the AAAI Conference on Artificial Intelligence, 2018
  2. T. Zheng et al. CLRNet: Cross Layer Refinement Network for Lane Detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022.

About

LaneNet: Enhanced Curved Lane Detection

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages