{"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/repvit-revisiting-mobile-cnn-from-vit","title":"RepViT: Revisiting Mobile CNN From ViT Perspective","arxiv_id":"2307.09283","date":"2023-07-18","proceeding":"CVPR 2024 1","authors":["Ao Wang","Hui Chen","Zijia Lin","Jungong Han","Guiguang Ding"],"abstract":"Recently, lightweight Vision Transformers (ViTs) demonstrate superior performance and lower latency, compared with lightweight Convolutional Neural Networks (CNNs), on resource-constrained mobile devices. Researchers have discovered many structural connections between lightweight ViTs and lightweight CNNs. However, the notable architectural disparities in the block structure, macro, and micro designs between them have not been adequately examined. In this study, we revisit the efficient design of lightweight CNNs from ViT perspective and emphasize their promising prospect for mobile devices. Specifically, we incrementally enhance the mobile-friendliness of a standard lightweight CNN, \\ie, MobileNetV3, by integrating the efficient architectural designs of lightweight ViTs. This ends up with a new family of pure lightweight CNNs, namely RepViT. Extensive experiments show that RepViT outperforms existing state-of-the-art lightweight ViTs and exhibits favorable latency in various vision tasks. Notably, on ImageNet, RepViT achieves over 80\\% top-1 accuracy with 1.0 ms latency on an iPhone 12, which is the first time for a lightweight model, to the best of our knowledge. Besides, when RepViT meets SAM, our RepViT-SAM can achieve nearly 10$\\times$ faster inference than the advanced MobileSAM. Codes and models are available at \\url{https://github.com/THU-MIG/RepViT}.","url_abs":"https://arxiv.org/abs/2307.09283v8","url_pdf":"https://arxiv.org/pdf/2307.09283v8.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":"repvit-revisiting-mobile-cnn-from-vit","repo_url":"https://github.com/THU-MIG/RepViT","is_official":0,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"repvit-revisiting-mobile-cnn-from-vit","repo_url":"https://github.com/jameslahm/RepViT","is_official":0,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"repvit-revisiting-mobile-cnn-from-vit","repo_url":"https://github.com/rwightman/pytorch-image-models","is_official":0,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"repvit-revisiting-mobile-cnn-from-vit","repo_url":"https://github.com/2023-MindSpore-4/Code10/tree/main/VIT","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null},{"paper_slug":"repvit-revisiting-mobile-cnn-from-vit","repo_url":"https://github.com/2023-MindSpore-4/Code12/tree/main/MindFormers/vit","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null},{"paper_slug":"repvit-revisiting-mobile-cnn-from-vit","repo_url":"https://github.com/2023-MindSpore-4/Code9/tree/main/VIT","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null},{"paper_slug":"repvit-revisiting-mobile-cnn-from-vit","repo_url":"https://github.com/leondgarse/keras_cv_attention_models/tree/main/keras_cv_attention_models/repvit","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":null},{"paper_slug":"repvit-revisiting-mobile-cnn-from-vit","repo_url":"https://gitlab.com/birder/birder","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[],"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":"sam","method_name":"SAM"},{"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":{"atlas_url":"https://app.syntology.ai/?focus=2307.09283","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2307.09283"}},"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/rwightman/pytorch-image-models","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/2023-MindSpore-4/Code12/tree/main/MindFormers/vit","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/2023-MindSpore-4/Code9/tree/main/VIT","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/THU-MIG/RepViT","reach":{"status":"ok","spdx":"Apache-2.0"}},{"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/jameslahm/RepViT","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/leondgarse/keras_cv_attention_models/tree/main/keras_cv_attention_models/repvit","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/2023-MindSpore-4/Code10/tree/main/VIT","reach":null}],"summary":{"ran_fixture":2,"unverified":10},"by_repo_kind":{"named_in_paper":{"samples":6,"ran":2,"repositories":1},"listed":{"samples":6,"ran":0,"repositories":1}},"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":"733d7f0bedcb74c2","entry":"get_rel_pos","repo":"THU-MIG/RepViT","repo_kind":"named_in_paper","path":"sam/repvit_sam/modeling/image_encoder.py","file_url":"https://github.com/THU-MIG/RepViT/blob/HEAD/sam/repvit_sam/modeling/image_encoder.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"733d7f0bedcb74c2"}},{"code_sha256_prefix":"105fa08885dc36cc","entry":"window_partition","repo":"THU-MIG/RepViT","repo_kind":"named_in_paper","path":"sam/repvit_sam/modeling/image_encoder.py","file_url":"https://github.com/THU-MIG/RepViT/blob/HEAD/sam/repvit_sam/modeling/image_encoder.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"105fa08885dc36cc"}},{"code_sha256_prefix":"37f61ffdf6057577","entry":"align_input_shape_by_image_data_format","repo":"leondgarse/keras_cv_attention_models","repo_kind":"listed","path":"keras_cv_attention_models/backend.py","file_url":"https://github.com/leondgarse/keras_cv_attention_models/blob/HEAD/keras_cv_attention_models/backend.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":"37f61ffdf6057577"}},{"code_sha256_prefix":"f9bc5f31ce61cee8","entry":"build_sam_vit_b","repo":"THU-MIG/RepViT","repo_kind":"named_in_paper","path":"sam/repvit_sam/build_sam.py","file_url":"https://github.com/THU-MIG/RepViT/blob/HEAD/sam/repvit_sam/build_sam.py","link_basis":"harvester_set","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":"f9bc5f31ce61cee8"}},{"code_sha256_prefix":"6b77c1f11fff3ed6","entry":"build_sam_vit_h","repo":"THU-MIG/RepViT","repo_kind":"named_in_paper","path":"sam/repvit_sam/build_sam.py","file_url":"https://github.com/THU-MIG/RepViT/blob/HEAD/sam/repvit_sam/build_sam.py","link_basis":"harvester_set","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":"6b77c1f11fff3ed6"}},{"code_sha256_prefix":"3f8890e695469246","entry":"build_sam_vit_l","repo":"THU-MIG/RepViT","repo_kind":"named_in_paper","path":"sam/repvit_sam/build_sam.py","file_url":"https://github.com/THU-MIG/RepViT/blob/HEAD/sam/repvit_sam/build_sam.py","link_basis":"harvester_set","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":"3f8890e695469246"}},{"code_sha256_prefix":"e16a66a2573bda6b","entry":"get_plot_cols_rows","repo":"leondgarse/keras_cv_attention_models","repo_kind":"listed","path":"keras_cv_attention_models/plot_func.py","file_url":"https://github.com/leondgarse/keras_cv_attention_models/blob/HEAD/keras_cv_attention_models/plot_func.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":"e16a66a2573bda6b"}},{"code_sha256_prefix":"0bf53c29bb7ba1f9","entry":"in_train_phase","repo":"leondgarse/keras_cv_attention_models","repo_kind":"listed","path":"keras_cv_attention_models/backend.py","file_url":"https://github.com/leondgarse/keras_cv_attention_models/blob/HEAD/keras_cv_attention_models/backend.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":"0bf53c29bb7ba1f9"}},{"code_sha256_prefix":"e461556a7330926c","entry":"numpy_image_resize","repo":"leondgarse/keras_cv_attention_models","repo_kind":"listed","path":"keras_cv_attention_models/backend.py","file_url":"https://github.com/leondgarse/keras_cv_attention_models/blob/HEAD/keras_cv_attention_models/backend.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":"e461556a7330926c"}},{"code_sha256_prefix":"9044d73cb7a0bb47","entry":"put_text_on_image","repo":"leondgarse/keras_cv_attention_models","repo_kind":"listed","path":"keras_cv_attention_models/plot_func.py","file_url":"https://github.com/leondgarse/keras_cv_attention_models/blob/HEAD/keras_cv_attention_models/plot_func.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":"9044d73cb7a0bb47"}},{"code_sha256_prefix":"03d4c554098904fd","entry":"stack_and_plot_images","repo":"leondgarse/keras_cv_attention_models","repo_kind":"listed","path":"keras_cv_attention_models/plot_func.py","file_url":"https://github.com/leondgarse/keras_cv_attention_models/blob/HEAD/keras_cv_attention_models/plot_func.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":"03d4c554098904fd"}},{"code_sha256_prefix":"27be441cc8213e52","entry":"window_unpartition","repo":"THU-MIG/RepViT","repo_kind":"named_in_paper","path":"sam/repvit_sam/modeling/image_encoder.py","file_url":"https://github.com/THU-MIG/RepViT/blob/HEAD/sam/repvit_sam/modeling/image_encoder.py","link_basis":"harvester_set","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":"27be441cc8213e52"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}