{"id":22068443,"url":"https://github.com/htcr/sam_road","last_synced_at":"2026-01-12T02:54:01.636Z","repository":{"id":229422146,"uuid":"763335669","full_name":"htcr/sam_road","owner":"htcr","description":"Segment Anything Model for large-scale, vectorized road network extraction from aerial imagery. CVPRW 2024","archived":false,"fork":false,"pushed_at":"2024-08-10T18:36:56.000Z","size":3229,"stargazers_count":151,"open_issues_count":12,"forks_count":18,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-30T20:05:58.381Z","etag":null,"topics":["autonomous-driving","computer-vision","cvpr2024","graph","graph-neural-networks","graph-representation-learning","mapping","navigation","remote-sensing","scene-graph","scene-graph-generation","segment-anything","segmentation-models","transformers"],"latest_commit_sha":null,"homepage":"https://arxiv.org/pdf/2403.16051.pdf","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/htcr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-02-26T05:11:49.000Z","updated_at":"2024-11-26T07:06:11.000Z","dependencies_parsed_at":"2024-06-02T08:29:34.286Z","dependency_job_id":"93504898-22fa-4702-a654-c22a7009035b","html_url":"https://github.com/htcr/sam_road","commit_stats":null,"previous_names":["htcr/sam_road"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/htcr/sam_road","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htcr%2Fsam_road","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htcr%2Fsam_road/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htcr%2Fsam_road/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htcr%2Fsam_road/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/htcr","download_url":"https://codeload.github.com/htcr/sam_road/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/htcr%2Fsam_road/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266802637,"owners_count":23986384,"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-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["autonomous-driving","computer-vision","cvpr2024","graph","graph-neural-networks","graph-representation-learning","mapping","navigation","remote-sensing","scene-graph","scene-graph-generation","segment-anything","segmentation-models","transformers"],"created_at":"2024-11-30T20:04:02.239Z","updated_at":"2026-01-12T02:54:01.631Z","avatar_url":"https://github.com/htcr.png","language":"Python","funding_links":[],"categories":["Paper List"],"sub_categories":["Follow-up Papers"],"readme":"# Official codebase for \"Segment Anything Model for Road Network Graph Extraction\", CVPRW 2024\nhttps://arxiv.org/pdf/2403.16051.pdf\n\n[The paper](https://openaccess.thecvf.com/content/CVPR2024W/SG2RL/papers/Hetang_Segment_Anything_Model_for_Road_Network_Graph_Extraction_CVPRW_2024_paper.pdf) has been accepted by IEEE/CVF Computer Vision and Pattern Recognition Conference (CVPR) 2024, 2nd Workshop on Scene Graphs and Graph Representation Learning.\n\n[Received the best paper award of the workshop](https://sites.google.com/corp/view/sg2rl/). Big thanks to the organizers for the recognition!!\n\n## Demos\nPredicted road network graph in a large region (2km x 2km).\n![sam_road_cover](imgs/sam_road_cover.png)\n\nPredicted road network graphs and corresponding masks in dense urban with complex and irregular structures.\n![sam_road_mask_and_graph](imgs/sam_road_mask_and_graph.png)\n\n## Installation\nYou need the following:\n- an Nvidia GPU with latest CUDA and driver.\n- the latest pytorch.\n- pytorch lightning.\n- wandb.\n- Go, just for the APLS metric (we should really re-write this with pure python when time allows).\n- and pip install whatever is missing.\n\n\n## Getting Started\n\n### SAM Preparation\nDownload the ViT-B checkpoint from the official SAM directory. Put it under:  \n-sam_road  \n--sam_ckpts  \n---sam_vit_b_01ec64.pth  \n\n### Data Preparation\nRefer to the instructions in the RNGDet++ repo (https://github.com/TonyXuQAQ/RNGDetPlusPlus) to download City-scale and SpaceNet datasets.\nPut them in the main directory, structure like:  \n-sam_road  \n--cityscale  \n---20cities  \n--spacenet  \n---RGB_1.0_meter  \n\nDownload links copied from https://github.com/TonyXuQAQ/RNGDetPlusPlus\n#### SpaceNet\nhttps://drive.google.com/uc?id=1FiZVkEEEVir_iUJpEH5NQunrtlG0Ff1W\n\nThe data_split.json is copied from the dataset.json in this folder.\n\n#### CityScale\nhttps://drive.google.com/uc?id=1R8sI1RmFe3rUfWMQaOfsYlBDHpQxFH-H\n\nFind the 20cities folder under this folder.\n\nThen, run \"python generate_labes.py\" under both dirs.\n\n### Training\nCity-scale dataset:  \npython train.py --config=config/toponet_vitb_512_cityscale.yaml  \n\nSpaceNet dataset:  \npython train.py --config=config/toponet_vitb_256_spacenet.yaml  \n\nYou can find the checkpoints under lightning_logs dir.\n\n### Inference\npython inferencer.py --config=path_to_the_same_config_for_training --checkpoint=path_to_ckpt  \nThis saves the inference results and visualizations.\n\nInferencing with our checkpoints:\n\nCityscale:\n\npython inferencer.py --config=config/toponet_vitb_512_cityscale.yaml --checkpoint=/path_to/cityscale_vitb_512_e10.ckpt\n\nSpacenet:\n\npython inferencer.py --config=config/toponet_vitb_256_spacenet.yaml --checkpoint=/path_to/spacenet_vitb_256_e10.ckpt\n\n### Test\nGo to cityscale_metrics or spacenet_metrics, and run  \nbash eval_schedule.bash  \n\nCheck that script for details. It runs both APLS and TOPO and stores scores to your output dir.\n\n## Our Checkpoints\n[congrui/sam_road](https://huggingface.co/congrui/sam_road)\n\n## Citation\n```\n@article{hetang2024segment,\n  title={Segment Anything Model for Road Network Graph Extraction},\n  author={Hetang, Congrui and Xue, Haoru and Le, Cindy and Yue, Tianwei and Wang, Wenping and He, Yihui},\n  journal={arXiv preprint arXiv:2403.16051},\n  year={2024}\n}\n```\n\n## Acknowledgement\nWe sincerely appreciate the authors of the following codebases which made this project possible:\n- Segment Anything Model  \n- RNGDet++  \n- SAMed  \n- Detectron2  \n\n## TODO List\n- [x] Basic instructions\n- [x] Organize configs\n- [x] Add dependency list\n- [x] Add demos\n- [x] Add trained checkpoints\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhtcr%2Fsam_road","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhtcr%2Fsam_road","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhtcr%2Fsam_road/lists"}