This repository contains inference code for Lane Detection and Classification using a cascaded approach with Convolutional Neural Networks (CNNs). It utilizes ERFNet for lane segmentation and LCNet for lane classification.
The system performs two main tasks:
- Lane Segmentation: Identifies the pixels belonging to lanes in an image using ERFNet (Efficient Residual Factorized Network).
- Lane Classification: Classifies the detected lanes into different types (e.g., continuous, dashed) using LCNet.
This project is designed for inference using pretrained models.
├── main.ipynb # Main Jupyter Notebook for inference and visualization
├── models/ # Neural network model definitions
│ ├── erfnet.py # ERFNet architecture
│ └── lcnet.py # LCNet architecture
├── pretrained/ # Directory for pretrained model weights
│ ├── erfnet_tusimple.pth
│ └── classification_64_3class.pth
├── images/ # Directory for input images
├── functions.py # Helper functions for visualization
├── loss.py # Loss functions (used during training)
└── requirements.txt # Python dependencies
- Python 3.x
- PyTorch
- Torchvision
- Numpy
- Matplotlib
- Pillow (PIL)
-
Clone the repository (if you haven't already):
git clone <repository-url> cd Cascade-LD-master
-
Install dependencies:
pip install -r requirements.txt
-
Open the Jupyter Notebook:
jupyter notebook main.ipynb
-
Run the cells:
- The notebook will load the pretrained models (
erfnet_tusimple.pthandclassification_64_3class.pth). - It will load a sample image from the
images/directory. - It performs lane segmentation and classification.
- Finally, it visualizes the results, showing the detected lanes colored by their instance and class.
- The notebook will load the pretrained models (
- Segmentation Model: ERFNet trained on the TuSimple dataset.
- Classification Model: LCNet trained to classify lane types (Continuous, Dashed, Double-Dashed).
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.