{"id":23167330,"url":"https://github.com/sabadijou/clld_official","last_synced_at":"2025-10-17T04:54:46.010Z","repository":{"id":211659565,"uuid":"600758647","full_name":"sabadijou/clld_official","owner":"sabadijou","description":"Contrastive Learning for Lane Detection via cross-similarity","archived":false,"fork":false,"pushed_at":"2023-12-10T03:41:08.000Z","size":2102,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T19:22:14.581Z","etag":null,"topics":["contrastive-learning","instance-segmentation","lane-detection","parallel-programming","python","pytorch","self-supervised-learning"],"latest_commit_sha":null,"homepage":"https://www.mdu.se/en/malardalen-university/centre-for-industrial-digitalisation/projects/autodeep-research-project","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sabadijou.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-12T14:13:24.000Z","updated_at":"2024-06-13T08:40:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"4d971884-f34a-49e2-a358-807ca1386507","html_url":"https://github.com/sabadijou/clld_official","commit_stats":null,"previous_names":["sabadijou/clld_official"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sabadijou/clld_official","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sabadijou%2Fclld_official","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sabadijou%2Fclld_official/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sabadijou%2Fclld_official/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sabadijou%2Fclld_official/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sabadijou","download_url":"https://codeload.github.com/sabadijou/clld_official/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sabadijou%2Fclld_official/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279284936,"owners_count":26140124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-17T02:00:07.504Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contrastive-learning","instance-segmentation","lane-detection","parallel-programming","python","pytorch","self-supervised-learning"],"created_at":"2024-12-18T02:27:40.124Z","updated_at":"2025-10-17T04:54:45.948Z","avatar_url":"https://github.com/sabadijou.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Contrastive Learning for Lane Detection via Cross-Similarity\n\u003e[**Contrastive Learning for Lane Detection via Cross-Similarity**](https://arxiv.org/abs/2308.08242)\u003cbr\u003e\n\u003e[![arXiv](https://img.shields.io/badge/arXiv-2312.02151-b31b1b)](https://arxiv.org/abs/2308.08242)\n\n## Overview of CLLD\n\nContrastive Learning for Lane Detection via cross-similarity (CLLD), is a self-supervised learning method that tackles this challenge by enhancing lane detection models’ resilience to real-world conditions that cause lane low visibility. CLLD is a novel multitask contrastive learning that trains lane detection approaches to detect lane markings even in low visible situations by integrating local feature contrastive learning (CL) with our new proposed operation cross-similarity. To ease of understanding some details are listed in the following:\n\n- CLLD employs similarity learning to improve the performance of deep neural networks in lane detection, particularly in challenging scenarios. \n- The approach aims to enhance the knowledge base of neural networks used in lane detection.\n- Our experiments were carried out using `ImageNet` as a pretraining dataset. We employed pioneering lane detection models like  `RESA`, `CLRNet`, and `UNet`, to evaluate the impact of our approach on model performances.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"utils/images/architecture.jpg\" alt=\"CLLD architecture\" style=\"width:768px;\"\u003e\u003cbr\u003e\n  \u003ci\u003eCLLD architecture\u003c/i\u003e\n\u003c/p\u003e\n\n## Get started\n1. Clone the repository\n    ```\n    git clone https://github.com/sabadijou/clld_official.git\n    ```\n    We call this directory as `$RESA_ROOT`\n\n2. Create an environment and activate it (We've used conda. but it is optional)\n\n    ```Shell\n    conda create -n clld python=3.9 -y\n    conda activate clld\n    ```\n\n3. Install dependencies\n\n    ```Shell\n    # Install pytorch firstly, the cudatoolkit version should be same in your system. (you can also use pip to install pytorch and torchvision)\n    conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch\n      \n    # Install kornia and einops\n    pip install kornia\n    pip install einops\n\n    # Install other dependencies\n    pip install -r requirements.txt\n    ```\n## How to Run CLLD\nWe conducted pretraining using the training data from `ImageNet`. However, you are free to utilize other datasets and configurations as needed. The configuration file for our approach can be found in the `configs` folder.\n\nOnce the dataset and new configurations are in place, you can execute the approach using the following command:\n\n```Shell\npython main.py --dataset_path /Imagenet/train --encoder resnet50 --alpha 1 --batch_size 1024 --world_size 1 --gpus_id 0 1 \n```\nThe following is a quick guide on arguments:\n- `dataset_path`: Path to training data directory \n- `encoder`: Select an encoder for training. `resnet18`, `resnet34`, `resnet50`, `resnet101`, `resnet152`, `resnext50_32x4d`,`resnext101_32x8d`, `wide_resnet50_2`, `wide_resnet101_2`.\n- `alpha`: Cross similarity window size\n- `batch_size`: Select a batch size that suits the GPU infrastructure you are using.\n- `world_size`: For example, if you are training a model on a single machine with 4 GPUs, the world size is 4. If you have 2 machines, each with 4 GPUs, and you use all of them for training, the world size would be 8.\n- `gpus_id`: Please specify all the GPU IDs that you used for training the approach.\n## How to publish weights\nUpon completing the training phase, you can execute the command below to prepare the trained weights for use as prior knowledge in the backbone of a lane detection model.\n```Shell\npython main.py --checkpoint path/to/checkpoint --encoder resnet50 \n```\n\n## Our experiments\nWe specifically chose to evaluate CLLD with U-Net because it is a common encoder-decoder architecture used in various methods that approach lane detection as a segmentation-based problem. In addition, we tested our method using RESA, which is currently the state-of-the-art semantic segmentation lane detection method that is not based on the UNet architecture.This independent validation is necessary to ensure the accuracy of our results. Lastly, we evaluated CLLD using CLRNet, a leading anchor-based lane detection method.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"utils/images/visualized_results.jpg\" alt=\"Visualized results\" style=\"width:1024px;\"\u003e\u003cbr\u003e\n  \u003ci\u003eVisualized results\u003c/i\u003e\n\u003c/p\u003e\n\nPerformance of UNet on CuLane and TuSimple with different contrastive learnings.\n\n\n\u003ctable\u003e\n    \u003cthead\u003e\n        \u003ctr\u003e\n            \u003cth\u003e\u003cstrong\u003eMethod\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003e# Epoch\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003ePrecision (CuLane)\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003eRecall (CuLane)\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003eF1-measure (CuLane)\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003eAccuracy (TuSimple)\u003c/strong\u003e\u003c/th\u003e\n        \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd\u003ePixPro\u003c/td\u003e\n            \u003ctd\u003e100\u003c/td\u003e\n            \u003ctd\u003e73.68\u003c/td\u003e\n            \u003ctd\u003e67.15\u003c/td\u003e\n            \u003ctd\u003e70.27\u003c/td\u003e\n            \u003ctd\u003e95.92\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eVICRegL\u003c/td\u003e\n            \u003ctd\u003e300\u003c/td\u003e\n            \u003ctd\u003e67.75\u003c/td\u003e\n            \u003ctd\u003e63.43\u003c/td\u003e\n            \u003ctd\u003e65.54\u003c/td\u003e\n            \u003ctd\u003e93.58\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eDenseCL\u003c/td\u003e\n            \u003ctd\u003e200\u003c/td\u003e\n            \u003ctd\u003e63.8\u003c/td\u003e\n            \u003ctd\u003e58.4\u003c/td\u003e\n            \u003ctd\u003e60.98\u003c/td\u003e\n            \u003ctd\u003e96.13\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eMoCo-V2\u003c/td\u003e\n            \u003ctd\u003e200\u003c/td\u003e\n            \u003ctd\u003e63.08\u003c/td\u003e\n            \u003ctd\u003e57.74\u003c/td\u003e\n            \u003ctd\u003e60.29\u003c/td\u003e\n            \u003ctd\u003e96.04\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eCLLD (α=1)\u003c/td\u003e\n            \u003ctd\u003e100\u003c/td\u003e\n            \u003ctd\u003e71.98\u003c/td\u003e\n            \u003ctd\u003e69.2\u003c/td\u003e\n            \u003ctd\u003e70.56\u003c/td\u003e\n            \u003ctd\u003e95.9\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eCLLD (α=2)\u003c/td\u003e\n            \u003ctd\u003e100\u003c/td\u003e\n            \u003ctd\u003e70.69\u003c/td\u003e\n            \u003ctd\u003e69.36\u003c/td\u003e\n            \u003ctd\u003e70.02\u003c/td\u003e\n            \u003ctd\u003e95.98\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eCLLD (α=3)\u003c/td\u003e\n            \u003ctd\u003e100\u003c/td\u003e\n            \u003ctd\u003e71.31\u003c/td\u003e\n            \u003ctd\u003e69.59\u003c/td\u003e\n            \u003ctd\u003e70.43\u003c/td\u003e\n            \u003ctd\u003e96.17\u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\nPerformance of RESA on CuLane and TuSimple with different contrastive learnings.\n\n\u003ctable\u003e\n    \u003cthead\u003e\n        \u003ctr\u003e\n            \u003cth\u003e\u003cstrong\u003eMethod\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003e# Epoch\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003ePrecision (CuLane)\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003eRecall (CuLane)\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003eF1-measure (CuLane)\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003eAccuracy (TuSimple)\u003c/strong\u003e\u003c/th\u003e\n        \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd\u003ePixPro\u003c/td\u003e\n            \u003ctd\u003e100\u003c/td\u003e\n            \u003ctd\u003e77.41\u003c/td\u003e\n            \u003ctd\u003e73.69\u003c/td\u003e\n            \u003ctd\u003e75.51\u003c/td\u003e\n            \u003ctd\u003e96.6\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eVICRegL\u003c/td\u003e\n            \u003ctd\u003e300\u003c/td\u003e\n            \u003ctd\u003e76.27\u003c/td\u003e\n            \u003ctd\u003e69.58\u003c/td\u003e\n            \u003ctd\u003e72.77\u003c/td\u003e\n            \u003ctd\u003e96.18\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eDenseCL\u003c/td\u003e\n            \u003ctd\u003e200\u003c/td\u003e\n            \u003ctd\u003e77.67\u003c/td\u003e\n            \u003ctd\u003e73.51\u003c/td\u003e\n            \u003ctd\u003e75.53\u003c/td\u003e\n            \u003ctd\u003e96.28\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eMoCo-V2\u003c/td\u003e\n            \u003ctd\u003e200\u003c/td\u003e\n            \u003ctd\u003e78.12\u003c/td\u003e\n            \u003ctd\u003e73.36\u003c/td\u003e\n            \u003ctd\u003e75.66\u003c/td\u003e\n            \u003ctd\u003e96.56\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eCLLD (α=1)\u003c/td\u003e\n            \u003ctd\u003e100\u003c/td\u003e\n            \u003ctd\u003e79.01\u003c/td\u003e\n            \u003ctd\u003e72.99\u003c/td\u003e\n            \u003ctd\u003e75.88\u003c/td\u003e\n            \u003ctd\u003e96.74\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eCLLD (α=2)\u003c/td\u003e\n            \u003ctd\u003e100\u003c/td\u003e\n            \u003ctd\u003e78\u003c/td\u003e\n            \u003ctd\u003e73.45\u003c/td\u003e\n            \u003ctd\u003e75.66\u003c/td\u003e\n            \u003ctd\u003e96.78\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eCLLD (α=3)\u003c/td\u003e\n            \u003ctd\u003e100\u003c/td\u003e\n            \u003ctd\u003e78.34\u003c/td\u003e\n            \u003ctd\u003e74.29\u003c/td\u003e\n            \u003ctd\u003e76.26\u003c/td\u003e\n            \u003ctd\u003e96.81\u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\nPerformance of CLRNet on CLRNet and TuSimple with different contrastive learnings.\n\n\n\u003ctable\u003e\n    \u003cthead\u003e\n        \u003ctr\u003e\n            \u003cth\u003e\u003cstrong\u003eMethod\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003e# Epoch\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003ePrecision (CuLane)\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003eRecall (CuLane)\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003eF1-measure (CuLane)\u003c/strong\u003e\u003c/th\u003e\n            \u003cth\u003e\u003cstrong\u003eAccuracy (TuSimple)\u003c/strong\u003e\u003c/th\u003e\n        \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd\u003ePixPro\u003c/td\u003e\n            \u003ctd\u003e100\u003c/td\u003e\n            \u003ctd\u003e89.19\u003c/td\u003e\n            \u003ctd\u003e70.39\u003c/td\u003e\n            \u003ctd\u003e78.67\u003c/td\u003e\n            \u003ctd\u003e93.88\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eVICRegL\u003c/td\u003e\n            \u003ctd\u003e300\u003c/td\u003e\n            \u003ctd\u003e87.72\u003c/td\u003e\n            \u003ctd\u003e71.15\u003c/td\u003e\n            \u003ctd\u003e78.72\u003c/td\u003e\n            \u003ctd\u003e89.01\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eDenseCL\u003c/td\u003e\n            \u003ctd\u003e200\u003c/td\u003e\n            \u003ctd\u003e88.07\u003c/td\u003e\n            \u003ctd\u003e69.67\u003c/td\u003e\n            \u003ctd\u003e77.8\u003c/td\u003e\n            \u003ctd\u003e85.15\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eMoCo-V2\u003c/td\u003e\n            \u003ctd\u003e200\u003c/td\u003e\n            \u003ctd\u003e88.91\u003c/td\u003e\n            \u003ctd\u003e71.02\u003c/td\u003e\n            \u003ctd\u003e78.96\u003c/td\u003e\n            \u003ctd\u003e93.87\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eCLLD (α=1)\u003c/td\u003e\n            \u003ctd\u003e100\u003c/td\u003e\n            \u003ctd\u003e88.72\u003c/td\u003e\n            \u003ctd\u003e71.33\u003c/td\u003e\n            \u003ctd\u003e79.09\u003c/td\u003e\n            \u003ctd\u003e90.68\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eCLLD (α=2)\u003c/td\u003e\n            \u003ctd\u003e100\u003c/td\u003e\n            \u003ctd\u003e87.95\u003c/td\u003e\n            \u003ctd\u003e71.44\u003c/td\u003e\n            \u003ctd\u003e78.84\u003c/td\u003e\n            \u003ctd\u003e93.48\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eCLLD (α=3)\u003c/td\u003e\n            \u003ctd\u003e100\u003c/td\u003e\n            \u003ctd\u003e88.59\u003c/td\u003e\n            \u003ctd\u003e71.73\u003c/td\u003e\n            \u003ctd\u003e79.27\u003c/td\u003e\n            \u003ctd\u003e94.25\u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\n ## Acknowledgement\n\u003c!--ts--\u003e\n* [RESA](https://openaccess.thecvf.com/content/CVPR2021/html/Xie_Propagate_Yourself_Exploring_Pixel-Level_Consistency_for_Unsupervised_Visual_Representation_Learning_CVPR_2021_paper.html)\n* [CLRNet](https://github.com/Turoad/CLRNet/tree/main)\n* [UNet](https://arxiv.org/abs/1505.04597)\n\u003c!--te--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsabadijou%2Fclld_official","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsabadijou%2Fclld_official","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsabadijou%2Fclld_official/lists"}