{"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/regionvit-regional-to-local-attention-for","title":"RegionViT: Regional-to-Local Attention for Vision Transformers","arxiv_id":"2106.02689","date":"2021-06-04","proceeding":"ICLR 2022 4","authors":["Chun-Fu Chen","Rameswar Panda","Quanfu Fan"],"abstract":"Vision transformer (ViT) has recently shown its strong capability in achieving comparable results to convolutional neural networks (CNNs) on image classification. However, vanilla ViT simply inherits the same architecture from the natural language processing directly, which is often not optimized for vision applications. Motivated by this, in this paper, we propose a new architecture that adopts the pyramid structure and employ a novel regional-to-local attention rather than global self-attention in vision transformers. More specifically, our model first generates regional tokens and local tokens from an image with different patch sizes, where each regional token is associated with a set of local tokens based on the spatial location. The regional-to-local attention includes two steps: first, the regional self-attention extract global information among all regional tokens and then the local self-attention exchanges the information among one regional token and the associated local tokens via self-attention. Therefore, even though local self-attention confines the scope in a local region but it can still receive global information. Extensive experiments on four vision tasks, including image classification, object and keypoint detection, semantics segmentation and action recognition, show that our approach outperforms or is on par with state-of-the-art ViT variants including many concurrent works. Our source codes and models are available at https://github.com/ibm/regionvit.","url_abs":"https://arxiv.org/abs/2106.02689v3","url_pdf":"https://arxiv.org/pdf/2106.02689v3.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":"regionvit-regional-to-local-attention-for","repo_url":"https://github.com/IBM/RegionViT","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"regionvit-regional-to-local-attention-for","repo_url":"https://github.com/conceptofmind/Region-ViT-flax","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"jax","reach":null},{"paper_slug":"regionvit-regional-to-local-attention-for","repo_url":"https://github.com/dc3ea9f/RegionViT","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"regionvit-regional-to-local-attention-for","repo_url":"https://gitlab.com/birder/birder","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"action-recognition-in-videos","task_name":"Action Recognition"},{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"keypoint-detection","task_name":"Keypoint Detection"},{"task_slug":"object-detection","task_name":"Object Detection"},{"task_slug":"image-classification","task_name":"image-classification"}],"methods":[{"method_slug":"regionvit","method_name":"RegionViT"}],"datasets_introduced":[],"methods_introduced":[{"slug":"regionvit","name":"RegionViT","full_name":"RegionViT"}],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2106.02689","atlas_url":"https://app.syntology.ai/?focus=2106.02689","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2106.02689"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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":"deterministic:regex_extraction","url":"https://github.com/IBM/RegionViT","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/conceptofmind/Region-ViT-flax","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://gitlab.com/birder/birder","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/dc3ea9f/RegionViT","reach":null}],"summary":{"ran":9,"ran_fixture":1,"ran_violates":1,"ran_honours":1,"ran_draft_wrong":1,"unverified":12},"by_repo_kind":{"official":{"samples":9,"ran":6,"repositories":1},"listed":{"samples":16,"ran":7,"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":"c7197ed401e12d9c","entry":"AttentionWithRelPos","repo":"IBM/RegionViT","repo_kind":"official","path":"regionvit/regionvit.py","file_url":"https://github.com/IBM/RegionViT/blob/HEAD/regionvit/regionvit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c7197ed401e12d9c"}},{"code_sha256_prefix":"67186f084bc62090","entry":"DropPath","repo":"dc3ea9f/RegionViT","repo_kind":"listed","path":"models/region_vit.py","file_url":"https://github.com/dc3ea9f/RegionViT/blob/HEAD/models/region_vit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"67186f084bc62090"}},{"code_sha256_prefix":"fb988c11d14bdbfc","entry":"LayerNorm2d","repo":"IBM/RegionViT","repo_kind":"official","path":"regionvit/regionvit.py","file_url":"https://github.com/IBM/RegionViT/blob/HEAD/regionvit/regionvit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"fb988c11d14bdbfc"}},{"code_sha256_prefix":"02fc42edbfdbea41","entry":"MultiHeadSelfAttention","repo":"dc3ea9f/RegionViT","repo_kind":"listed","path":"models/region_vit.py","file_url":"https://github.com/dc3ea9f/RegionViT/blob/HEAD/models/region_vit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"02fc42edbfdbea41"}},{"code_sha256_prefix":"bc7dfc56f71e7a9b","entry":"PatchEmbed","repo":"dc3ea9f/RegionViT","repo_kind":"listed","path":"models/region_vit.py","file_url":"https://github.com/dc3ea9f/RegionViT/blob/HEAD/models/region_vit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bc7dfc56f71e7a9b"}},{"code_sha256_prefix":"6688b31853ed31b4","entry":"PatchEmbed","repo":"IBM/RegionViT","repo_kind":"official","path":"regionvit/regionvit.py","file_url":"https://github.com/IBM/RegionViT/blob/HEAD/regionvit/regionvit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"6688b31853ed31b4"}},{"code_sha256_prefix":"77415c05ec9a1664","entry":"PatchMerging","repo":"dc3ea9f/RegionViT","repo_kind":"listed","path":"models/region_vit.py","file_url":"https://github.com/dc3ea9f/RegionViT/blob/HEAD/models/region_vit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"77415c05ec9a1664"}},{"code_sha256_prefix":"54d188ee9d7b46be","entry":"Projection","repo":"IBM/RegionViT","repo_kind":"official","path":"regionvit/regionvit.py","file_url":"https://github.com/IBM/RegionViT/blob/HEAD/regionvit/regionvit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"54d188ee9d7b46be"}},{"code_sha256_prefix":"eb1f3e402e1dc74c","entry":"R2LAttentionPlusFFN","repo":"IBM/RegionViT","repo_kind":"official","path":"regionvit/regionvit.py","file_url":"https://github.com/IBM/RegionViT/blob/HEAD/regionvit/regionvit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"eb1f3e402e1dc74c"}},{"code_sha256_prefix":"b3f0623f46fcc9af","entry":"convert_to_flatten_layout","repo":"IBM/RegionViT","repo_kind":"official","path":"regionvit/regionvit.py","file_url":"https://github.com/IBM/RegionViT/blob/HEAD/regionvit/regionvit.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b3f0623f46fcc9af"}},{"code_sha256_prefix":"cc47cc901f6ee6ea","entry":"divisible_by","repo":"conceptofmind/Region-ViT-flax","repo_kind":"listed","path":"region_vit_flax.py","file_url":"https://github.com/conceptofmind/Region-ViT-flax/blob/HEAD/region_vit_flax.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cc47cc901f6ee6ea"}},{"code_sha256_prefix":"0936ade4b0df66b9","entry":"get_2d_relative_position_index","repo":"dc3ea9f/RegionViT","repo_kind":"listed","path":"models/region_vit.py","file_url":"https://github.com/dc3ea9f/RegionViT/blob/HEAD/models/region_vit.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0936ade4b0df66b9"}},{"code_sha256_prefix":"b572c48319c37542","entry":"remap_position_index","repo":"dc3ea9f/RegionViT","repo_kind":"listed","path":"models/region_vit.py","file_url":"https://github.com/dc3ea9f/RegionViT/blob/HEAD/models/region_vit.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b572c48319c37542"}},{"code_sha256_prefix":"43d3378c696e6de4","entry":"Attention","repo":"conceptofmind/Region-ViT-flax","repo_kind":"listed","path":"region_vit_flax.py","file_url":"https://github.com/conceptofmind/Region-ViT-flax/blob/HEAD/region_vit_flax.py","link_basis":"first_harvest_node","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":"43d3378c696e6de4"}},{"code_sha256_prefix":"23ae2961428275c4","entry":"BasicLayer","repo":"dc3ea9f/RegionViT","repo_kind":"listed","path":"models/region_vit.py","file_url":"https://github.com/dc3ea9f/RegionViT/blob/HEAD/models/region_vit.py","link_basis":"first_harvest_node","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":"23ae2961428275c4"}},{"code_sha256_prefix":"fbf61a6af6d13754","entry":"ConvAttBlock","repo":"IBM/RegionViT","repo_kind":"official","path":"regionvit/regionvit.py","file_url":"https://github.com/IBM/RegionViT/blob/HEAD/regionvit/regionvit.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"fbf61a6af6d13754"}},{"code_sha256_prefix":"ddaf1aef43c3e9f2","entry":"Downsample","repo":"conceptofmind/Region-ViT-flax","repo_kind":"listed","path":"region_vit_flax.py","file_url":"https://github.com/conceptofmind/Region-ViT-flax/blob/HEAD/region_vit_flax.py","link_basis":"first_harvest_node","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":"ddaf1aef43c3e9f2"}},{"code_sha256_prefix":"4a180adb3206c763","entry":"MLP","repo":"conceptofmind/Region-ViT-flax","repo_kind":"listed","path":"region_vit_flax.py","file_url":"https://github.com/conceptofmind/Region-ViT-flax/blob/HEAD/region_vit_flax.py","link_basis":"first_harvest_node","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":"4a180adb3206c763"}},{"code_sha256_prefix":"701acfe4475d1a8d","entry":"PEG","repo":"conceptofmind/Region-ViT-flax","repo_kind":"listed","path":"region_vit_flax.py","file_url":"https://github.com/conceptofmind/Region-ViT-flax/blob/HEAD/region_vit_flax.py","link_basis":"first_harvest_node","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":"701acfe4475d1a8d"}},{"code_sha256_prefix":"90fc7131c656ed6b","entry":"R2LEncoderBlock","repo":"dc3ea9f/RegionViT","repo_kind":"listed","path":"models/region_vit.py","file_url":"https://github.com/dc3ea9f/RegionViT/blob/HEAD/models/region_vit.py","link_basis":"first_harvest_node","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":"90fc7131c656ed6b"}},{"code_sha256_prefix":"7b8ebb406d076c7a","entry":"R2LTransformer","repo":"conceptofmind/Region-ViT-flax","repo_kind":"listed","path":"region_vit_flax.py","file_url":"https://github.com/conceptofmind/Region-ViT-flax/blob/HEAD/region_vit_flax.py","link_basis":"first_harvest_node","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":"7b8ebb406d076c7a"}},{"code_sha256_prefix":"d872e0d4743209a6","entry":"RegionViT","repo":"dc3ea9f/RegionViT","repo_kind":"listed","path":"models/region_vit.py","file_url":"https://github.com/dc3ea9f/RegionViT/blob/HEAD/models/region_vit.py","link_basis":"first_harvest_node","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":"d872e0d4743209a6"}},{"code_sha256_prefix":"9717421cdc52208a","entry":"RegionViT","repo":"IBM/RegionViT","repo_kind":"official","path":"regionvit/regionvit.py","file_url":"https://github.com/IBM/RegionViT/blob/HEAD/regionvit/regionvit.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9717421cdc52208a"}},{"code_sha256_prefix":"eda0483677e50eae","entry":"RegionViT","repo":"conceptofmind/Region-ViT-flax","repo_kind":"listed","path":"region_vit_flax.py","file_url":"https://github.com/conceptofmind/Region-ViT-flax/blob/HEAD/region_vit_flax.py","link_basis":"first_harvest_node","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":"eda0483677e50eae"}},{"code_sha256_prefix":"cc95bcc461e63789","entry":"convert_to_spatial_layout","repo":"IBM/RegionViT","repo_kind":"official","path":"regionvit/regionvit.py","file_url":"https://github.com/IBM/RegionViT/blob/HEAD/regionvit/regionvit.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cc95bcc461e63789"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}