### Run Demo Evaluation Source: https://github.com/czyczyyzc/condlstr/blob/master/tools/metrics/lane/openlane/README.md Executes a demo evaluation using provided example JSON files. Navigate to the example directory first. ```bash cd example bash eval_demo.sh ``` -------------------------------- ### Install Project Requirements Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Install all necessary Python packages listed in the requirements.txt file. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install OpenCV Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Clones the OpenCV repository, builds it with Release type, and installs it to /usr/local. Ensure you have sufficient build tools and permissions. ```bash git clone https://github.com/opencv/opencv.git cd ~/opencv mkdir build cd build cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. make -j7 sudo make install ``` -------------------------------- ### Install Progress Library Source: https://github.com/czyczyyzc/condlstr/blob/master/utils/progress/README.rst Command to install the progress library using pip. ```shell pip install progress ``` -------------------------------- ### Install PyTorch Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Install PyTorch version 2.0.0 or higher using pip. Ensure torchvision and torchaudio are also installed. ```bash pip install torch torchvision torchaudio torchdata ``` -------------------------------- ### Example Evaluation Command Source: https://github.com/czyczyyzc/condlstr/blob/master/tools/metrics/lane/openlane/README.md An example of how to execute the evaluation script with specific paths and parameters for dataset, results, images, test list, lane width, IoU, and output. ```bash ./evaluate \ -a ./Dataset/OpenLane/lane3d_v2.0/ \ -d ./Evaluation/PersFormer/result_dir/ \ -i ./Dataset/OpenLane/images/ \ -l ./Evaluation/PersFormer/test_list.txt \ -w 30 \ -t 0.3 \ -o ./Evaluation/PersFormer/ \ ``` -------------------------------- ### Install MMCV Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Install MMCV version 2.0.0 or higher. This requires installing openmim first. ```bash pip install -U openmim mim install mmcv ``` -------------------------------- ### Example 3D Lane Evaluation Command Source: https://github.com/czyczyyzc/condlstr/blob/master/tools/metrics/lane/openlane/README.md An example of how to run the evaluation script with specific directory paths for dataset, predictions, and the test list file. ```bash python eval_3D_lane.py \ --dataset_dir=./Dataset/OpenLane/lane3d_v2.0/ \ --pred_dir=./Evaluation/PersFormer/result_dir/ \ --test_list=./Evaluation/PersFormer/test_list.txt \ ``` -------------------------------- ### Install OpenLane Evaluation Tool Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Navigates to the OpenLane evaluation tool directory and compiles it using make. Remember to specify your OpenCV include and library paths in the Makefile. ```bash cd /path/to/project/tools/metrics/lane/openlane/lane2d # specify your opencv path in ./Makefile#L40,41 (OPENCV_INCLUDE and OPENCV_LIB_PATH) make ``` -------------------------------- ### Basic Spinner Usage Source: https://github.com/czyczyyzc/condlstr/blob/master/utils/progress/README.rst Provides an example of using a spinner for tasks with an unknown number of steps. ```python from progress.spinner import Spinner spinner = Spinner('Loading ') while state != 'FINISHED': # Do some work spinner.next() ``` -------------------------------- ### Progress Bar as a Context Manager Source: https://github.com/czyczyyzc/condlstr/blob/master/utils/progress/README.rst Shows how to use a progress bar with a 'with' statement for automatic handling of start and finish. ```python from progress.bar import Bar with Bar('Processing', max=20) as bar: for i in range(20): # Do some work bar.next() ``` -------------------------------- ### Create Python Environment Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Use conda to create a new Python environment for the project. Activate it before proceeding with other installations. ```bash conda create -n hdmapnet python=3.10 conda activate hdmapnet ``` -------------------------------- ### Finetune with Pretrained Model Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Finetunes the model using a pretrained checkpoint. Place the checkpoint file in the specified log directory and use --resume --load-model-only flags. ```python python -m torch.distributed.launch --nproc_per_node=4 tools/train.py -a CondLSTR2DRes34 -d openlane -v 2d -c 21 -t lane_det_2d --data-dir /path/to/datasets/ --logs-dir /path/to/checkpoint --gpu-ids 0,1,2,3 -b 4 -j 4 --resume --load-model-only ``` -------------------------------- ### Basic Progress Bar Usage Source: https://github.com/czyczyyzc/condlstr/blob/master/utils/progress/README.rst Demonstrates the fundamental way to use a progress bar by manually calling next() and finish(). ```python from progress.bar import Bar bar = Bar('Processing', max=20) for i in range(20): # Do some work bar.next() bar.finish() ``` -------------------------------- ### Resume Training from Checkpoint Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Resumes a distributed training process from a saved checkpoint. Ensure the checkpoint path is correctly specified. ```python python -m torch.distributed.launch --nproc_per_node=4 tools/train.py -a CondLSTR2DRes34 -d openlane -v 2d -c 21 -t lane_det_2d --data-dir /path/to/datasets/ --logs-dir /path/to/checkpoint --gpu-ids 0,1,2,3 -b 4 -j 4 --resume ``` -------------------------------- ### Run CondLSTR2DRes34 Model on OpenLane Dataset Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Launches the testing script for the CondLSTR2DRes34 model on the OpenLane dataset using distributed training. Ensure you have the correct paths for datasets, checkpoints, and logs. ```bash python -m torch.distributed.launch --nproc_per_node=4 tools/test.py -a CondLSTR2DRes34 -d openlane -v 2d -c 21 -t lane_det_2d --data-dir /path/to/datasets/ --logs-dir /path/to/checkpoint --test-dir /path/to/checkpoint --gpu-ids 0,1,2,3 -b 4 -j 4 ``` -------------------------------- ### Training Debug Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Initiates a training run for lane detection with specified parameters. Ensure dataset and log directories are correctly set. ```python python tools/train.py -a CondLSTR2DRes34 -d openlane -v 2d -c 21 -t lane_det_2d --data-dir /path/to/datasets/ --logs-dir /path/to/checkpoint -b 4 -j 4 ``` -------------------------------- ### Creating a Custom Progress Bar Subclass Source: https://github.com/czyczyyzc/condlstr/blob/master/utils/progress/README.rst Demonstrates how to create a custom progress bar by subclassing 'Bar' and overriding default attributes. ```python class FancyBar(Bar): message = 'Loading' fill = '*' suffix = '%(percent).1f%% - %(eta)ds' ``` -------------------------------- ### Multi-GPU Training Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Launches distributed training across multiple GPUs using torch.distributed.launch. Specify the number of GPUs and their IDs. ```python python -m torch.distributed.launch --nproc_per_node=4 tools/train.py -a CondLSTR2DRes34 -d openlane -v 2d -c 21 -t lane_det_2d --data-dir /path/to/datasets/ --logs-dir /path/to/checkpoint --gpu-ids 0,1,2,3 -b 4 -j 4 ``` -------------------------------- ### Run 3D Lane Evaluation Script Source: https://github.com/czyczyyzc/condlstr/blob/master/tools/metrics/lane/openlane/README.md Command to execute the 3D lane evaluation script. Ensure you are in the 'lane3d' directory and provide paths to the dataset, prediction results, and test list. ```bash cd lane3d python eval_3D_lane.py --dataset_dir $dataset_dir --pred_dir $pred_dir --test_list $test_list ``` -------------------------------- ### Set OpenCV Library Path Source: https://github.com/czyczyyzc/condlstr/blob/master/tools/metrics/lane/openlane/README.md Environment variable export command to resolve 'libopencv not found' errors by specifying the path to the OpenCV library. ```bash export LD_LIBRARY_PATH=/path/to/opencv/lib64/:$LD_LIBRARY_PATH ``` -------------------------------- ### Training with AMP Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Enables Automated Mixed Precision (AMP) for distributed training to potentially speed up training and reduce memory usage. Use the '-p amp' flag. ```python python -m torch.distributed.launch --nproc_per_node=4 tools/train.py -a CondLSTR2DRes34 -d openlane -v 2d -c 21 -t lane_det_2d --data-dir /path/to/datasets/ --logs-dir /path/to/checkpoint --gpu-ids 0,1,2,3 -b 4 -j 4 -p amp ``` -------------------------------- ### Evaluation Debug Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Runs an evaluation process for lane detection, similar to training but with the --eval flag. Ensure dataset and log directories are correctly set. ```python python tools/train.py -a CondLSTR2DRes34 -d openlane -v 2d -c 21 -t lane_det_2d --data-dir /path/to/datasets/ --logs-dir /path/to/checkpoint -b 4 -j 4 --eval ``` -------------------------------- ### Custom Progress Bar with Calculated Suffix Source: https://github.com/czyczyyzc/condlstr/blob/master/utils/progress/README.rst Shows how to create a custom progress bar with a suffix that includes a calculated property like remaining hours. ```python class SlowBar(Bar): suffix = '%(remaining_hours)d hours remaining' @property def remaining_hours(self): return self.eta // 3600 ``` -------------------------------- ### Iterating with Progress Bar Source: https://github.com/czyczyyzc/condlstr/blob/master/utils/progress/README.rst Illustrates using the 'iter' method to wrap an iterable and automatically update the progress bar. ```python for i in Bar('Processing').iter(it): # Do some work ``` -------------------------------- ### Test/Visualization Debug Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Executes a test run for lane detection, generating visualizations. Specify output directory for test results. ```python python tools/test.py -a CondLSTR2DRes34 -d openlane -v 2d -c 21 -t lane_det_2d --data-dir /path/to/datasets/ --logs-dir /path/to/checkpoint --test-dir /path/to/output -b 4 -j 4 ``` -------------------------------- ### Configure CUDA Environment Variables Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Set CUDA environment variables for CUDA 11.7. Ensure these are added to your ~/.bashrc and sourced. ```bash export CUDA_HOME=/usr/local/cuda-11 export PATH=$PATH:$CUDA_HOME/bin export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} ``` -------------------------------- ### Evaluate OpenLane 2D Predictions Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Runs the OpenLane 2D evaluation script. This command requires the directory containing the model predictions and the directory with the ground truth annotations. The --translate flag is used for translation. ```bash python tools/metrics/lane/openlane/openlane_2d.py --pred-dir /path/to/output --anno-dir /path/to/datasets/openlane --translate ``` -------------------------------- ### Customizing Progress Bar Appearance Source: https://github.com/czyczyyzc/condlstr/blob/master/utils/progress/README.rst Explains how to customize the fill character and suffix message of a progress bar during instantiation. ```python bar = Bar('Loading', fill='@', suffix='%(percent)d%%') ``` -------------------------------- ### Multi-GPU Test/Visualization Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Runs distributed testing and visualization across multiple GPUs. Specify the output directory for test results. ```python python -m torch.distributed.launch --nproc_per_node=4 tools/test.py -a CondLSTR2DRes34 -d openlane -v 2d -c 21 -t lane_det_2d --data-dir /path/to/datasets/ --logs-dir /path/to/checkpoint --test-dir /path/to/output --gpu-ids 0,1,2,3 -b 4 -j 4 ``` -------------------------------- ### Evaluation Script Command Source: https://github.com/czyczyyzc/condlstr/blob/master/tools/metrics/lane/openlane/README.md Command to run the lane detection evaluation script. Specify dataset, results, images, test list, lane width, IoU threshold, and output file. ```bash cd lane2d ./evaluate -a $dataset_dir -d $result_dir -i $image_dir -l $test_list -w $w_lane -t $iou -o $output_file ``` -------------------------------- ### Result JSON Structure Source: https://github.com/czyczyyzc/condlstr/blob/master/tools/metrics/lane/openlane/README.md Defines the expected structure for result JSON files, including image file path and lane line details with category and pixel coordinates. ```json { "file_path": -- image path "lane_lines": [ { "category": -- lane category "uv": [2, n] -- 2D lane points in pixel coordinate }, ... ] } ``` -------------------------------- ### Multi-GPU Evaluation Source: https://github.com/czyczyyzc/condlstr/blob/master/README.md Performs distributed evaluation across multiple GPUs. Ensure the correct number of processes and GPU IDs are specified. ```python python -m torch.distributed.launch --nproc_per_node=4 tools/train.py -a CondLSTR2DRes34 -d openlane -v 2d -c 21 -t lane_det_2d --data-dir /path/to/datasets/ --logs-dir /path/to/checkpoint --gpu-ids 0,1,2,3 -b 4 -j 4 --eval ``` -------------------------------- ### 3D Lane Prediction Result JSON Structure Source: https://github.com/czyczyyzc/condlstr/blob/master/tools/metrics/lane/openlane/README.md Defines the expected structure for JSON files containing 3D lane prediction results, including camera intrinsic/extrinsic matrices, image path, and lane line details with coordinates and category. ```json { "intrinsic": [3, 3] -- camera intrinsic matrix "extrinsic": [4, 4] -- camera extrinsic matrix "file_path": -- image path "lane_lines": [ { "xyz": [3, n] -- x,y,z coordinates of sampled points in vehicle coordinate "category": -- lane category }, ... (k lanes in `lane_lines` dict) ] } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.