{"id":13442548,"url":"https://github.com/NVlabs/SegFormer","last_synced_at":"2025-03-20T14:31:21.301Z","repository":{"id":37740447,"uuid":"376096061","full_name":"NVlabs/SegFormer","owner":"NVlabs","description":"Official PyTorch implementation of SegFormer","archived":false,"fork":false,"pushed_at":"2024-08-02T15:50:33.000Z","size":2699,"stargazers_count":2760,"open_issues_count":109,"forks_count":375,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-03-13T13:06:29.978Z","etag":null,"topics":["ade20k","cityscapes","semantic-segmentation","transformer"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2105.15203","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NVlabs.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":"2021-06-11T17:22:07.000Z","updated_at":"2025-03-12T13:08:21.000Z","dependencies_parsed_at":"2024-01-18T14:41:08.870Z","dependency_job_id":"dcaceb13-9415-4966-be8c-2261ac667176","html_url":"https://github.com/NVlabs/SegFormer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NVlabs%2FSegFormer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NVlabs%2FSegFormer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NVlabs%2FSegFormer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NVlabs%2FSegFormer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NVlabs","download_url":"https://codeload.github.com/NVlabs/SegFormer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244627444,"owners_count":20483804,"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","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":["ade20k","cityscapes","semantic-segmentation","transformer"],"created_at":"2024-07-31T03:01:47.112Z","updated_at":"2025-03-20T14:31:21.254Z","avatar_url":"https://github.com/NVlabs.png","language":"Python","funding_links":[],"categories":["Python","Table of Contents"],"sub_categories":["DETR变种"],"readme":"[![NVIDIA Source Code License](https://img.shields.io/badge/license-NSCL-blue.svg)](https://github.com/NVlabs/SegFormer/blob/master/LICENSE)\n![Python 3.8](https://img.shields.io/badge/python-3.8-green.svg)\n\n# SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers\n\n\u003c!-- ![image](resources/image.png) --\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./resources/image.png\" height=\"400\"\u003e\n\u003c/div\u003e\n\u003cp align=\"center\"\u003e\n  Figure 1: Performance of SegFormer-B0 to SegFormer-B5.\n\u003c/p\u003e\n\n### [Project page](https://github.com/NVlabs/SegFormer) | [Paper](https://arxiv.org/abs/2105.15203) | [Demo (Youtube)](https://www.youtube.com/watch?v=J0MoRQzZe8U) | [Demo (Bilibili)](https://www.bilibili.com/video/BV1MV41147Ko/) | [Intro Video](https://www.youtube.com/watch?v=nBjXyoltCHU)\n\nSegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers.\u003cbr\u003e\n[Enze Xie](https://xieenze.github.io/), [Wenhai Wang](https://whai362.github.io/), [Zhiding Yu](https://chrisding.github.io/), [Anima Anandkumar](http://tensorlab.cms.caltech.edu/users/anima/), [Jose M. Alvarez](https://rsu.data61.csiro.au/people/jalvarez/), and [Ping Luo](http://luoping.me/).\u003cbr\u003e\nNeurIPS 2021.\n\nThis repository contains the official Pytorch implementation of training \u0026 evaluation code and the pretrained models for [SegFormer](https://arxiv.org/abs/2105.15203).\n\nSegFormer is a simple, efficient and powerful semantic segmentation method, as shown in Figure 1.\n\nWe use [MMSegmentation v0.13.0](https://github.com/open-mmlab/mmsegmentation/tree/v0.13.0) as the codebase.\n\n🔥🔥 SegFormer is on [MMSegmentation](https://github.com/open-mmlab/mmsegmentation/tree/master/configs/segformer). 🔥🔥 \n\n\n## Installation\n\nFor install and data preparation, please refer to the guidelines in [MMSegmentation v0.13.0](https://github.com/open-mmlab/mmsegmentation/tree/v0.13.0).\n\nOther requirements:\n```pip install timm==0.3.2```\n\nAn example (works for me): ```CUDA 10.1``` and  ```pytorch 1.7.1``` \n\n```\npip install torchvision==0.8.2\npip install timm==0.3.2\npip install mmcv-full==1.2.7\npip install opencv-python==4.5.1.48\ncd SegFormer \u0026\u0026 pip install -e . --user\n```\n\n## Evaluation\n\nDownload `trained weights`. \n(\n[google drive](https://drive.google.com/drive/folders/1GAku0G0iR9DsBxCbfENWMJ27c5lYUeQA?usp=sharing) | \n[onedrive](https://connecthkuhk-my.sharepoint.com/:f:/g/personal/xieenze_connect_hku_hk/Ept_oetyUGFCsZTKiL_90kUBy5jmPV65O5rJInsnRCDWJQ?e=CvGohw)\n)\n\nExample: evaluate ```SegFormer-B1``` on ```ADE20K```:\n\n```\n# Single-gpu testing\npython tools/test.py local_configs/segformer/B1/segformer.b1.512x512.ade.160k.py /path/to/checkpoint_file\n\n# Multi-gpu testing\n./tools/dist_test.sh local_configs/segformer/B1/segformer.b1.512x512.ade.160k.py /path/to/checkpoint_file \u003cGPU_NUM\u003e\n\n# Multi-gpu, multi-scale testing\ntools/dist_test.sh local_configs/segformer/B1/segformer.b1.512x512.ade.160k.py /path/to/checkpoint_file \u003cGPU_NUM\u003e --aug-test\n```\n\n## Training\n\nDownload `weights` \n(\n[google drive](https://drive.google.com/drive/folders/1b7bwrInTW4VLEm27YawHOAMSMikga2Ia?usp=sharing) | \n[onedrive](https://connecthkuhk-my.sharepoint.com/:f:/g/personal/xieenze_connect_hku_hk/EvOn3l1WyM5JpnMQFSEO5b8B7vrHw9kDaJGII-3N9KNhrg?e=cpydzZ)\n) \npretrained on ImageNet-1K, and put them in a folder ```pretrained/```.\n\nExample: train ```SegFormer-B1``` on ```ADE20K```:\n\n```\n# Single-gpu training\npython tools/train.py local_configs/segformer/B1/segformer.b1.512x512.ade.160k.py \n\n# Multi-gpu training\n./tools/dist_train.sh local_configs/segformer/B1/segformer.b1.512x512.ade.160k.py \u003cGPU_NUM\u003e\n```\n\n## Visualize\n\nHere is a demo script to test a single image. More details refer to [MMSegmentation's Doc](https://mmsegmentation.readthedocs.io/en/latest/get_started.html).\n\n```shell\npython demo/image_demo.py ${IMAGE_FILE} ${CONFIG_FILE} ${CHECKPOINT_FILE} [--device ${DEVICE_NAME}] [--palette-thr ${PALETTE}]\n```\n\nExample: visualize ```SegFormer-B1``` on ```CityScapes```: \n\n```shell\npython demo/image_demo.py demo/demo.png local_configs/segformer/B1/segformer.b1.512x512.ade.160k.py \\\n/path/to/checkpoint_file --device cuda:0 --palette cityscapes\n```\n\n\n\n\n\n## License\nPlease check the LICENSE file. SegFormer may be used non-commercially, meaning for research or \nevaluation purposes only. For business inquiries, please visit our website and submit the form: [NVIDIA Research Licensing](https://www.nvidia.com/en-us/research/inquiries/).\n\n\n## Citation\n```\n@inproceedings{xie2021segformer,\n  title={SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers},\n  author={Xie, Enze and Wang, Wenhai and Yu, Zhiding and Anandkumar, Anima and Alvarez, Jose M and Luo, Ping},\n  booktitle={Neural Information Processing Systems (NeurIPS)},\n  year={2021}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNVlabs%2FSegFormer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNVlabs%2FSegFormer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNVlabs%2FSegFormer/lists"}