{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/topformer-token-pyramid-transformer-for","title":"TopFormer: Token Pyramid Transformer for Mobile Semantic Segmentation","arxiv_id":"2204.05525","date":"2022-04-12","proceeding":"CVPR 2022 1","authors":["Wenqiang Zhang","Zilong Huang","Guozhong Luo","Tao Chen","Xinggang Wang","Wenyu Liu","Gang Yu","Chunhua Shen"],"abstract":"Although vision transformers (ViTs) have achieved great success in computer vision, the heavy computational cost hampers their applications to dense prediction tasks such as semantic segmentation on mobile devices. In this paper, we present a mobile-friendly architecture named \\textbf{To}ken \\textbf{P}yramid Vision Trans\\textbf{former} (\\textbf{TopFormer}). The proposed \\textbf{TopFormer} takes Tokens from various scales as input to produce scale-aware semantic features, which are then injected into the corresponding tokens to augment the representation. Experimental results demonstrate that our method significantly outperforms CNN- and ViT-based networks across several semantic segmentation datasets and achieves a good trade-off between accuracy and latency. On the ADE20K dataset, TopFormer achieves 5\\% higher accuracy in mIoU than MobileNetV3 with lower latency on an ARM-based mobile device. Furthermore, the tiny version of TopFormer achieves real-time inference on an ARM-based mobile device with competitive results. The code and models are available at: https://github.com/hustvl/TopFormer","url_abs":"https://arxiv.org/abs/2204.05525v1","url_pdf":"https://arxiv.org/pdf/2204.05525v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"topformer-token-pyramid-transformer-for","repo_url":"https://github.com/hustvl/TopFormer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"topformer-token-pyramid-transformer-for","repo_url":"https://github.com/ibaiGorordo/ONNX-TopFormer-Semantic-Segmentation","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"topformer-token-pyramid-transformer-for","repo_url":"https://github.com/ibaiGorordo/depthai-TopFormer-Semantic-Segmentation","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"segmentation","task_name":"Segmentation"},{"task_slug":"semantic-segmentation","task_name":"Semantic Segmentation"}],"methods":[{"method_slug":"1x1-convolution","method_name":"1x1 Convolution"},{"method_slug":"average-pooling","method_name":"Average Pooling"},{"method_slug":"batch-normalization","method_name":"Batch Normalization"},{"method_slug":"convolution","method_name":"Convolution"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"depthwise-convolution","method_name":"Depthwise Convolution"},{"method_slug":"depthwise-separable-convolution","method_name":"Depthwise Separable Convolution"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"global-average-pooling","method_name":"Global Average Pooling"},{"method_slug":"hard-swish","method_name":"Hard Swish"},{"method_slug":"inverted-residual-block","method_name":"Inverted Residual Block"},{"method_slug":"pointwise-convolution","method_name":"Pointwise Convolution"},{"method_slug":"relu","method_name":"ReLU"},{"method_slug":"relu6","method_name":"ReLU6"},{"method_slug":"sigmoid-activation","method_name":"Sigmoid Activation"},{"method_slug":"squeeze-and-excitation-block","method_name":"Squeeze-and-Excitation Block"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2204.05525","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2204.05525"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ibaiGorordo/ONNX-TopFormer-Semantic-Segmentation","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/hustvl/TopFormer","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ibaiGorordo/depthai-TopFormer-Semantic-Segmentation","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":5},"by_repo_kind":{"listed":{"samples":5,"ran":0,"repositories":2}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"a9f78e8ca9e9edab","entry":"read_ade20k_info","repo":"ibaiGorordo/ONNX-TopFormer-Semantic-Segmentation","repo_kind":"listed","path":"topformer/utils.py","file_url":"https://github.com/ibaiGorordo/ONNX-TopFormer-Semantic-Segmentation/blob/HEAD/topformer/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a9f78e8ca9e9edab"}},{"code_sha256_prefix":"6ac24263cdfd96fa","entry":"read_ade20k_info","repo":"ibaiGorordo/depthai-TopFormer-Semantic-Segmentation","repo_kind":"listed","path":"utils/utils.py","file_url":"https://github.com/ibaiGorordo/depthai-TopFormer-Semantic-Segmentation/blob/HEAD/utils/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6ac24263cdfd96fa"}},{"code_sha256_prefix":"d9ed597a3e422e31","entry":"to_planar","repo":"ibaiGorordo/depthai-TopFormer-Semantic-Segmentation","repo_kind":"listed","path":"main_video.py","file_url":"https://github.com/ibaiGorordo/depthai-TopFormer-Semantic-Segmentation/blob/HEAD/main_video.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d9ed597a3e422e31"}},{"code_sha256_prefix":"5c78baf53db25975","entry":"util_draw_seg","repo":"ibaiGorordo/ONNX-TopFormer-Semantic-Segmentation","repo_kind":"listed","path":"topformer/utils.py","file_url":"https://github.com/ibaiGorordo/ONNX-TopFormer-Semantic-Segmentation/blob/HEAD/topformer/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5c78baf53db25975"}},{"code_sha256_prefix":"2579f2b31e9a3233","entry":"util_draw_seg","repo":"ibaiGorordo/depthai-TopFormer-Semantic-Segmentation","repo_kind":"listed","path":"utils/utils.py","file_url":"https://github.com/ibaiGorordo/depthai-TopFormer-Semantic-Segmentation/blob/HEAD/utils/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2579f2b31e9a3233"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}