This repository contains two Python scripts for lane marking labeling and segmentation in image sequences. The scripts facilitate manual labeling of lane points and automate the labeling process for subsequent frames. Additionally, segmentation masks are generated from the labeled points for training purposes.
This script allows for manual annotation of lane markings on images and automates the labeling process for subsequent frames. The user manually selects lane points, and the script generates .lines.txt files containing the labeled points. It also enables automatic adjustment of lane points for consecutive frames based on user-defined directions.
- Allows manual selection of lane points on an image.
- Supports setting lane directions (left, right, up, down, straight) using arrow keys.
- Saves labeled points in .lines.txtfiles.
- Automates lane point adjustments for subsequent frames.
- Displays annotated frames for visualization.
Modify the input_dir and output_dir variables to match your dataset structure. Run:
python manual_labeling.py- Mouse Left-click: Select a lane point.
- 'k' key: Save the current lane and start a new one.
- Arrow keys: Set direction (Left, Right, Up, Down, default is Straight).
- 'Enter' key: Finish selection and proceed.
This script generates segmentation masks from lane markings stored in .lines.txt files. It reads image paths from train.txt, processes each image, and creates segmentation masks by connecting lane points with lines.
- Reads labeled points from .lines.txtfiles.
- Generates binary lane segmentation masks.
- Saves masks in a new directory (laneseg_label_w16/images).
- Updates the training file with new image-mask paths.
Modify the base_dir variable to your dataset location. Run:
python make_seg.py- The masks are saved as .pngfiles inlaneseg_label_w16/images.
- The updated x_train.txtfile contains new image-mask paths.
Ensure you have the required dependencies installed:
pip install opencv-python numpyrepo/
│── manual_labeling.py  # Manual labeling and automation script
│── make_seg.py         # Lane segmentation mask generation script
│── datasets/
│   ├── assisttaxi2/
│   │   ├── train/
│   │   │   ├── images/  # Original images
│   │   │   ├── train.txt  # List of training images
│   │   │   ├── laneseg_label_w16/  # Output segmentation masks
│   ├── valid/
│   │   ├── images2/  # Validation images
│   │   ├── processed_images/  # Processed images with annotations
- Ensure images are stored in the correct directories before running the scripts.
- Adjust step_sizeandadjustment_factorinmanual_labeling.pyfor optimal automation.