[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-snap-research--EfficientFormer":3,"tool-snap-research--EfficientFormer":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",142651,2,"2026-04-06T23:34:12",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107888,"2026-04-06T11:32:50",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":77,"owner_email":77,"owner_twitter":77,"owner_website":78,"owner_url":79,"languages":80,"stars":89,"forks":90,"last_commit_at":91,"license":92,"difficulty_score":10,"env_os":93,"env_gpu":94,"env_ram":95,"env_deps":96,"category_tags":107,"github_topics":108,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":118,"updated_at":119,"faqs":120,"releases":156},4803,"snap-research\u002FEfficientFormer","EfficientFormer","EfficientFormerV2 [ICCV 2023] & EfficientFormer [NeurIPs 2022]","EfficientFormer 是一系列专为移动端设备设计的视觉 Transformer 模型，旨在让复杂的 AI 视觉任务也能在手机上跑得飞快。它主要解决了传统 Vision Transformer（ViT）虽然精度高，但计算量大、延迟高，难以在手机等资源受限设备上流畅运行的痛点。即便与多年前的轻量级卷积网络 MobileNet 相比，旧版 ViT 在速度和体积上仍显笨重。\n\nEfficientFormer 通过重新思考架构设计，提出了一种改进的超网结构，并结合细粒度的联合搜索策略，同时优化模型的延迟和参数量。其升级版 EfficientFormerV2 更是在保持与 MobileNet 相当的运行速度和模型大小的前提下，将图像分类准确率提升了约 4%。这意味着开发者无需在“高精度”和“高速度”之间做妥协。\n\n这套工具非常适合需要在移动端部署高性能视觉算法的 AI 开发者、研究人员以及嵌入式系统工程师。无论是进行图像分类、目标检测还是语义分割，EfficientFormer 都能提供高效的预训练模型和完整的转换工具（支持 CoreML 和 ONNX），帮助用户轻松将前沿算法落地到 i","EfficientFormer 是一系列专为移动端设备设计的视觉 Transformer 模型，旨在让复杂的 AI 视觉任务也能在手机上跑得飞快。它主要解决了传统 Vision Transformer（ViT）虽然精度高，但计算量大、延迟高，难以在手机等资源受限设备上流畅运行的痛点。即便与多年前的轻量级卷积网络 MobileNet 相比，旧版 ViT 在速度和体积上仍显笨重。\n\nEfficientFormer 通过重新思考架构设计，提出了一种改进的超网结构，并结合细粒度的联合搜索策略，同时优化模型的延迟和参数量。其升级版 EfficientFormerV2 更是在保持与 MobileNet 相当的运行速度和模型大小的前提下，将图像分类准确率提升了约 4%。这意味着开发者无需在“高精度”和“高速度”之间做妥协。\n\n这套工具非常适合需要在移动端部署高性能视觉算法的 AI 开发者、研究人员以及嵌入式系统工程师。无论是进行图像分类、目标检测还是语义分割，EfficientFormer 都能提供高效的预训练模型和完整的转换工具（支持 CoreML 和 ONNX），帮助用户轻松将前沿算法落地到 iPhone 等移动设备中，实现真正的端侧智能。","## EfficientFormerV2\u003Cbr>\u003Csub>Rethinking Vision Transformers for MobileNet Size and Speed\u003C\u002Fsub>\n\n[arXiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F2212.08059) | [PDF](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2212.08059.pdf)\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fsnap-research_EfficientFormer_readme_bbeda11fcb13.png\" width=70%> \u003Cbr>\n  Models are trained on ImageNet-1K and deployed on iPhone 12 with CoreMLTools to get latency.\n\u003C\u002Fp>\n\n>[Rethinking Vision Transformers for MobileNet Size and Speed](https:\u002F\u002Farxiv.org\u002Fabs\u002F2212.08059)\u003Cbr>\n>[Yanyu Li](https:\u002F\u002Fscholar.google.com\u002Fcitations?view_op=list_works&hl=en&hl=en&user=XUj8koUAAAAJ&sortby=pubdate)\u003Csup>1,2\u003C\u002Fsup>, [Ju Hu](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Ferichuju\u002F)\u003Csup>1\u003C\u002Fsup>, [Yang Wen](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fyang-wen-76749924\u002F)\u003Csup>1\u003C\u002Fsup>, [Georgios Evangelidis](https:\u002F\u002Fsites.google.com\u002Fsite\u002Fgeorgeevangelidis\u002F)\u003Csup>1\u003C\u002Fsup>, [Kamyar Salahi](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fkamyarsalahi\u002F)\u003Csup>3\u003C\u002Fsup>, \u003Cbr>[Yanzhi Wang](https:\u002F\u002Fcoe.northeastern.edu\u002Fpeople\u002Fwang-yanzhi\u002F)\u003Csup>2\u003C\u002Fsup>, [Sergey Tulyakov](http:\u002F\u002Fwww.stulyakov.com\u002F)\u003Csup>1\u003C\u002Fsup>, [Jian Ren](https:\u002F\u002Falanspike.github.io\u002F)\u003Csup>1\u003C\u002Fsup>  \n>\u003Csup>1\u003C\u002Fsup>Snap Inc., \u003Csup>2\u003C\u002Fsup>Northeastern University, \u003Csup>3\u003C\u002Fsup>UC Berkeley\n\n\u003Cdetails>\n  \u003Csummary>\n  \u003Cfont size=\"+1\">Abstract\u003C\u002Ffont>\n  \u003C\u002Fsummary>\nWith the success of Vision Transformers (ViTs) in computer vision tasks, recent arts try to optimize the performance and complexity of ViTs to enable efficient deployment on mobile devices.\nMultiple approaches are proposed to accelerate attention mechanism, improve inefficient designs, or incorporate mobile-friendly lightweight convolutions to form hybrid architectures.\nHowever, ViT and its variants still have higher latency or considerably more parameters than lightweight CNNs, even true for the years-old MobileNet. \nIn practice, latency and size are both crucial for efficient deployment on resource-constraint hardware. \nIn this work, we investigate a central question, can transformer models run as fast as MobileNet and maintain a similar size? \nWe revisit the design choices of ViTs and propose an improved supernet with low latency and high parameter efficiency. \nWe further introduce a fine-grained joint search strategy that can find efficient architectures by optimizing latency and number of parameters simultaneously. The proposed models, EfficientFormerV2, achieve about 4% higher top-1 accuracy than MobileNetV2 and MobileNetV2x1.4 on ImageNet-1K with similar latency and parameters. We demonstrate that properly designed and optimized vision transformers can achieve high performance with MobileNet-level size and speed.\n\u003C\u002Fdetails>\n\n\u003Cbr>\n\n### Changelog and ToDos\n- [x] Add EfficientFormerV2 model family, including `efficientformerv2_s0`, `efficientformerv2_s1`, `efficientformerv2_s2` and `efficientformerv2_l`. \n- [x] Pretrained checkpoints of EfficientFormerV2 on ImageNet-1K are released. \n- [x] Update EfficientFormerV2 in downstream tasks (detection, segmentation). \n- [x] Release checkpoints in downstream tasks. \n- [x] Add extra tools for profiling and deployment (we use CoreML==5.2 and Torch==1.11), example usage: \n\n```\npython toolbox.py --model efficientformerv2_l --ckpt weights\u002Feformer_l_450.pth --onnx --coreml\n```\n\n\n## EfficientFormer\u003Cbr>\u003Csub>Vision Transformers at MobileNet Speed\u003C\u002Fsub>\n\n[arXiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F2206.01191) | [PDF](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2206.01191.pdf)\n\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fsnap-research_EfficientFormer_readme_593a3faf1a55.png\" width=70%> \u003Cbr>\n  Models are trained on ImageNet-1K and measured by iPhone 12 with CoreMLTools to get latency.\n\u003C\u002Fp>\n\n\n\n>[EfficientFormer: Vision Transformers at MobileNet Speed](https:\u002F\u002Farxiv.org\u002Fabs\u002F2206.01191)\u003Cbr>\n>[Yanyu Li](https:\u002F\u002Fscholar.google.com\u002Fcitations?view_op=list_works&hl=en&hl=en&user=XUj8koUAAAAJ&sortby=pubdate)\u003Csup>1,2\u003C\u002Fsup>, [Genge Yuan](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=tBIAgtgAAAAJ&hl)\u003Csup>1,2\u003C\u002Fsup>, [Yang Wen](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fyang-wen-76749924\u002F)\u003Csup>1\u003C\u002Fsup>, [Eric Hu](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Ferichuju\u002F)\u003Csup>1\u003C\u002Fsup>, [Georgios Evangelidis](https:\u002F\u002Fsites.google.com\u002Fsite\u002Fgeorgeevangelidis\u002F)\u003Csup>1\u003C\u002Fsup>, \u003Cbr>[Sergey Tulyakov](http:\u002F\u002Fwww.stulyakov.com\u002F)\u003Csup>1\u003C\u002Fsup>, [Yanzhi Wang](https:\u002F\u002Fcoe.northeastern.edu\u002Fpeople\u002Fwang-yanzhi\u002F)\u003Csup>2\u003C\u002Fsup>, [Jian Ren](https:\u002F\u002Falanspike.github.io\u002F)\u003Csup>1\u003C\u002Fsup>  \n>\u003Csup>1\u003C\u002Fsup>Snap Inc., \u003Csup>2\u003C\u002Fsup>Northeastern University\n\n\n\u003Cdetails>\n  \u003Csummary>\n  \u003Cfont size=\"+1\">Abstract\u003C\u002Ffont>\n  \u003C\u002Fsummary>\n    Vision Transformers (ViT) have shown rapid progress in computer vision tasks, achieving promising results on various benchmarks. However, due to the massive number of parameters and model design, e.g., attention mechanism, ViT-based models are generally times slower than lightweight convolutional networks. Therefore, the deployment of ViT for real-time applications is particularly challenging, especially on resource-constrained hardware such as mobile devices. Recent efforts try to reduce the computation complexity of ViT through network architecture search or hybrid design with MobileNet block, yet the inference speed is still unsatisfactory. This leads to an important question: can transformers run as fast as MobileNet while obtaining high performance? To answer this, we first revisit the network architecture and operators used in ViT-based models and identify inefficient designs. Then we introduce a dimension-consistent pure transformer (without MobileNet blocks) as a design paradigm. Finally, we perform latency-driven slimming to get a series of final models dubbed EfficientFormer. Extensive experiments show the superiority of EfficientFormer in performance and speed on mobile devices. Our fastest model, EfficientFormer-L1, achieves 79.2% top-1 accuracy on ImageNet-1K with only 1.6 ms inference latency on iPhone 12 (compiled with CoreML), which runs as fast as MobileNetV2x1.4 (1.6 ms, 74.7% top-1), and our largest model, EfficientFormer-L7, obtains 83.3% accuracy with only 7.0 ms latency. Our work proves that properly designed transformers can reach extremely low latency on mobile devices while maintaining high performance.\n\u003C\u002Fdetails>\n\n\n\u003Cbr>\n\n\n\n## Classification on ImageNet-1K\n\n### Models\n\n| Model | Top-1 (300\u002F450)| #params | MACs | Latency | ckpt | ONNX | CoreML |\n|:---------------|:----:|:---:|:--:|:--:|:--:|:--:|:--:|\n| EfficientFormerV2-S0 |   75.7 \u002F 76.2   |     3.5M    |   0.40B   |      0.9ms     |  [S0](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1PXb7b9pv9ZB4cfkRkYEdwgWuVwvEiazq\u002Fview?usp=share_link)    |   [S0](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1xWev98ENruLnnxgFXORmrYzNG5Y8b8y6\u002Fview?usp=share_link)   |    [S0](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F19G3RGcH42gqPBa42CV3yIOmSmVVFqW0X\u002Fview?usp=share_link)    |\n| EfficientFormerV2-S1 |   79.0 \u002F 79.7   |     6.1M    |   0.65B   |      1.1ms     |   [S1](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1EKe1vt-3mG7iceVIMaET_DyISzVTJMn8\u002Fview?usp=share_link)   |   [S1](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1f4eYkY3Tkmyn_GrDk4QqbpWYcF07CukT\u002Fview?usp=share_link)   |    [S1](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1EXI0uq3yt0KpMlItjJlnghYfAzWgdbRj\u002Fview?usp=share_link)    |\n| EfficientFormerV2-S2 |   81.6 \u002F 82.0   |    12.6M   |   1.25B   |      1.6ms     |   [S2](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1gjbFyB5T_yAkmzHNuXEljqScYVQZafMQ\u002Fview?usp=share_link)   |   [S2](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1kJj2UxUQR-ro4WslcnsukcJF9BXi0FMC\u002Fview?usp=share_link)   |    [S2](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1KQw7UMujsHrLUCDOY-pO6rM7zfp7cpDY\u002Fview?usp=share_link)    |\n| EfficientFormerV2-L |   83.3 \u002F 83.5   |    26.1M    |   2.56B   |      2.7ms     |  [L](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1sRXNBHl_ewHBMwwYZVsOJo1k6JpcNJn-\u002Fview?usp=share_link)    |   [L](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F18GfCWWdYYcEz_AOmoO6J7dW8xMtkIpcm\u002Fview?usp=share_link)   |     [L](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1Ynu7fTbqPEW9tSVZdR7ZAN1edUFAocGT\u002Fview?usp=share_link)   |\n\n\n\n| Model | Top-1 Acc.| Latency | Pytorch Checkpoint | CoreML | ONNX |\n| :------------ | :--: | :---: | :---: |:---: | :---: |\n| EfficientFormer-L1 |79.2 (80.2) | 1.6ms| [L1-300](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1wtEmkshLFEYFsX5YhBttBOGYaRvDR7nu\u002Fview?usp=sharing) ([L1-1000](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F11SbX-3cfqTOc247xKYubrAjBiUmr818y\u002Fview?usp=sharing)) | [L1](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1MEDcyeKCBmrgVGrHX8wew3l4ge2CWdok\u002Fview?usp=sharing) | [L1](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F10NMPW8SLLiTa2jwTTuILDQRUzMvehmUM\u002Fview?usp=sharing) |\n| EfficientFormer-L3 |82.4 | 3.0ms| [L3](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1OyyjKKxDyMj-BcfInp4GlDdwLu3hc30m\u002Fview?usp=sharing) | [L3](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F12xb0_6pPAy0OWdW39seL9TStIqKyguEj\u002Fview?usp=sharing) | [L3](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1DEbsOEzP4ljS6-ka86BtwQWiVxkylCaX\u002Fview?usp=sharing) |\n| EfficientFormer-L7 |83.3  | 7.0ms| [L7](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1cVw-pctJwgvGafeouynqWWCwgkcoFMM5\u002Fview?usp=sharing) | [L7](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1CnhAyfylpvvebT9Yn3qF8vrUFjZjuO3F\u002Fview?usp=sharing) | [L7](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1u6But9JQ9Wd7vlaFTGcYm5FiGnQ8y9eS\u002Fview?usp=sharing) |\n\n\n\n## Latency Measurement \n\nThe latency reported in EffcientFormerV2 for iPhone 12 (iOS 16) uses the benchmark tool from [XCode 14](https:\u002F\u002Fdeveloper.apple.com\u002Fvideos\u002Fplay\u002Fwwdc2022\u002F10027\u002F).\n\nFor EffcientFormerV1, we use the [coreml-performance](https:\u002F\u002Fgithub.com\u002Fvladimir-chernykh\u002Fcoreml-performance). Thanks for the nice-implemented latency measurement! \n\n*Tips*: MacOS+XCode and a mobile device (iPhone 12) are needed to reproduce the reported speed. \n\n\n\n## ImageNet  \n\n### Prerequisites\n`conda` virtual environment is recommended. \n```\nconda install pytorch torchvision cudatoolkit=11.3 -c pytorch\npip install timm\npip install submitit\n```\n\n### Data preparation\n\nDownload and extract ImageNet train and val images from http:\u002F\u002Fimage-net.org\u002F. The training and validation data are expected to be in the `train` folder and `val` folder respectively:\n```\n|-- \u002Fpath\u002Fto\u002Fimagenet\u002F\n    |-- train\n    |-- val\n```\n\n### Single machine multi-GPU training\n\nWe provide an example training script `dist_train.sh` using PyTorch distributed data parallel (DDP). \n\nTo train EfficientFormer-L1 on an 8-GPU machine:\n\n```\nsh dist_train.sh efficientformer_l1 8\n```\n\nTips: specify your data path and experiment name in the script! \n\n### Multi-node training\n\nOn a Slurm-managed cluster, multi-node training can be launched through [submitit](https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002Fsubmitit), for example, \n\n```\nsh slurm_train.sh efficientformer_l1\n```\n\nTips: specify GPUs\u002FCPUs\u002Fmemory per node in the script based on your resource!\n\n### Testing \n\nWe provide an example test script `dist_test.sh` using PyTorch distributed data parallel (DDP). \nFor example, to test EfficientFormer-L1 on an 8-GPU machine:\n\n```\nsh dist_test.sh efficientformer_l1 8 weights\u002Fefficientformer_l1_300d.pth\n```\n\n## Using EfficientFormer as backbone\n[Object Detection and Instance Segmentation](detection\u002FREADME.md)\u003Cbr>\n[Semantic Segmentation](segmentation\u002FREADME.md)\n## Acknowledgement\n\nClassification (ImageNet) code base is partly built with [LeViT](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FLeViT) and [PoolFormer](https:\u002F\u002Fgithub.com\u002Fsail-sg\u002Fpoolformer). \n\nThe detection and segmentation pipeline is from [MMCV](https:\u002F\u002Fgithub.com\u002Fopen-mmlab\u002Fmmcv) ([MMDetection](https:\u002F\u002Fgithub.com\u002Fopen-mmlab\u002Fmmdetection) and [MMSegmentation](https:\u002F\u002Fgithub.com\u002Fopen-mmlab\u002Fmmsegmentation)). \n\nThanks for the great implementations! \n\n## Citation\n\nIf our code or models help your work, please cite EfficientFormer (NeurIPs 2022) and EfficientFormerV2 (ICCV 2023):\n```BibTeX\n@article{li2022efficientformer,\n  title={Efficientformer: Vision transformers at mobilenet speed},\n  author={Li, Yanyu and Yuan, Geng and Wen, Yang and Hu, Ju and Evangelidis, Georgios and Tulyakov, Sergey and Wang, Yanzhi and Ren, Jian},\n  journal={Advances in Neural Information Processing Systems},\n  volume={35},\n  pages={12934--12949},\n  year={2022}\n}\n```\n```BibTeX\n@inproceedings{li2022rethinking,\n  title={Rethinking Vision Transformers for MobileNet Size and Speed},\n  author={Li, Yanyu and Hu, Ju and Wen, Yang and Evangelidis, Georgios and Salahi, Kamyar and Wang, Yanzhi and Tulyakov, Sergey and Ren, Jian},\n  booktitle={Proceedings of the IEEE international conference on computer vision},\n  year={2023}\n}\n```\n","## EfficientFormerV2\u003Cbr>\u003Csub>重新思考适用于移动设备尺寸与速度的视觉Transformer\u003C\u002Fsub>\n\n[arXiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F2212.08059) | [PDF](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2212.08059.pdf)\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fsnap-research_EfficientFormer_readme_bbeda11fcb13.png\" width=70%> \u003Cbr>\n  模型在ImageNet-1K上训练，并使用CoreMLTools部署到iPhone 12上以测量延迟。\n\u003C\u002Fp>\n\n>[重新思考适用于移动设备尺寸与速度的视觉Transformer](https:\u002F\u002Farxiv.org\u002Fabs\u002F2212.08059)\u003Cbr>\n>[李彦宇](https:\u002F\u002Fscholar.google.com\u002Fcitations?view_op=list_works&hl=en&hl=en&user=XUj8koUAAAAJ&sortby=pubdate)\u003Csup>1,2\u003C\u002Fsup>, [胡居](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Ferichuju\u002F)\u003Csup>1\u003C\u002Fsup>, [温洋](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fyang-wen-76749924\u002F)\u003Csup>1\u003C\u002Fsup>, [乔治奥斯·埃万杰利迪斯](https:\u002F\u002Fsites.google.com\u002Fsite\u002Fgeorgeevangelidis\u002F)\u003Csup>1\u003C\u002Fsup>, [卡米亚尔·萨拉希](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fkamyarsalahi\u002F)\u003Csup>3\u003C\u002Fsup>, \u003Cbr>[王延志](https:\u002F\u002Fcoe.northeastern.edu\u002Fpeople\u002Fwang-yanzhi\u002F)\u003Csup>2\u003C\u002Fsup>, [谢尔盖·图利亚科夫](http:\u002F\u002Fwww.stulyakov.com\u002F)\u003Csup>1\u003C\u002Fsup>, [任健](https:\u002F\u002Falanspike.github.io\u002F)\u003Csup>1\u003C\u002Fsup>  \n>\u003Csup>1\u003C\u002Fsup>Snap Inc., \u003Csup>2\u003C\u002Fsup>东北大学, \u003Csup>3\u003C\u002Fsup>加州大学伯克利分校\n\n\u003Cdetails>\n  \u003Csummary>\n  \u003Cfont size=\"+1\">摘要\u003C\u002Ffont>\n  \u003C\u002Fsummary>\n随着视觉Transformer（ViT）在计算机视觉任务中取得成功，近期的研究致力于优化ViT的性能和复杂度，以便在移动设备上高效部署。为此，研究者提出了多种方法来加速注意力机制、改进低效设计，或引入轻量级卷积以构建混合架构。然而，即使经过多年的发展，ViT及其变体的延迟仍然高于轻量级CNN，参数量也远超老牌的MobileNet。实际上，在资源受限的硬件上进行高效部署时，延迟和模型大小都至关重要。本文探讨了一个核心问题：Transformer模型能否像MobileNet一样快速运行，同时保持相似的模型规模？我们重新审视了ViT的设计选择，并提出了一种低延迟、高参数效率的改进超网络。此外，我们还引入了一种细粒度的联合搜索策略，能够同时优化延迟和参数数量，从而找到高效的架构。所提出的EfficientFormerV2模型在ImageNet-1K上的Top-1准确率比MobileNetV2和MobileNetV2x1.4高出约4%，且具有相似的延迟和参数量。我们的研究表明，经过合理设计和优化的视觉Transformer可以在与MobileNet相当的尺寸和速度下实现高性能。\n\u003C\u002Fdetails>\n\n\u003Cbr>\n\n### 更改记录与待办事项\n- [x] 添加EfficientFormerV2模型系列，包括`efficientformerv2_s0`、`efficientformerv2_s1`、`efficientformerv2_s2`和`efficientformerv2_l`。\n- [x] 发布EfficientFormerV2在ImageNet-1K上的预训练检查点。\n- [x] 更新EfficientFormerV2在下游任务（检测、分割）中的应用。\n- [x] 发布下游任务中的检查点。\n- [x] 增加用于性能分析和部署的工具（我们使用CoreML==5.2和Torch==1.11），示例用法如下：\n\n```\npython toolbox.py --model efficientformerv2_l --ckpt weights\u002Feformer_l_450.pth --onnx --coreml\n```\n\n\n## EfficientFormer\u003Cbr>\u003Csub>以MobileNet速度运行的视觉Transformer\u003C\u002Fsub>\n\n[arXiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F2206.01191) | [PDF](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2206.01191.pdf)\n\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fsnap-research_EfficientFormer_readme_593a3faf1a55.png\" width=70%> \u003Cbr>\n  模型在ImageNet-1K上训练，并使用iPhone 12和CoreMLTools测量延迟。\n\u003C\u002Fp>\n\n\n\n>[EfficientFormer：以MobileNet速度运行的视觉Transformer](https:\u002F\u002Farxiv.org\u002Fabs\u002F2206.01191)\u003Cbr>\n>[李彦宇](https:\u002F\u002Fscholar.google.com\u002Fcitations?view_op=list_works&hl=en&hl=en&user=XUj8koUAAAAJ&sortby=pubdate)\u003Csup>1,2\u003C\u002Fsup>, [袁根格](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=tBIAgtgAAAAJ&hl)\u003Csup>1,2\u003C\u002Fsup>, [温洋](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fyang-wen-76749924\u002F)\u003Csup>1\u003C\u002Fsup>, [胡埃里克](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Ferichuju\u002F)\u003Csup>1\u003C\u002Fsup>, [乔治奥斯·埃万杰利迪斯](https:\u002F\u002Fsites.google.com\u002Fsite\u002Fgeorgeevangelidis\u002F)\u003Csup>1\u003C\u002Fsup>, \u003Cbr>[谢尔盖·图利亚科夫](http:\u002F\u002Fwww.stulyakov.com\u002F)\u003Csup>1\u003C\u002Fsup>, [王延志](https:\u002F\u002Fcoe.northeastern.edu\u002Fpeople\u002Fwang-yanzhi\u002F)\u003Csup>2\u003C\u002Fsup>, [任健](https:\u002F\u002Falanspike.github.io\u002F)\u003Csup>1\u003C\u002Fsup>  \n>\u003Csup>1\u003C\u002Fsup>Snap Inc., \u003Csup>2\u003C\u002Fsup>东北大学\n\n\n\u003Cdetails>\n  \u003Csummary>\n  \u003Cfont size=\"+1\">摘要\u003C\u002Ffont>\n  \u003C\u002Fsummary>\n    视觉Transformer（ViT）在计算机视觉任务中取得了快速发展，在各类基准测试中表现出色。然而，由于其庞大的参数量以及注意力机制等模型设计特点，基于ViT的模型通常比轻量级卷积网络慢得多。因此，将ViT部署于实时应用场景尤其具有挑战性，特别是在资源受限的硬件设备上，如移动设备。近年来，研究人员尝试通过网络架构搜索或与MobileNet模块结合的混合设计来降低ViT的计算复杂度，但其推理速度仍不理想。这引发了一个重要问题：Transformer能否在获得高性能的同时，达到与MobileNet相当的速度？为回答这一问题，我们首先回顾了ViT类模型中使用的网络架构和操作符，识别出其中的低效设计。随后，我们提出了一种完全基于Transformer的设计范式（不包含MobileNet模块）。最后，我们通过延迟驱动的精简策略，得到了一系列名为EfficientFormer的最终模型。大量实验表明，EfficientFormer在移动设备上的性能和速度均优于现有方案。我们最快的模型EfficientFormer-L1在ImageNet-1K上达到了79.2%的Top-1准确率，而在iPhone 12上仅需1.6毫秒的推理延迟（使用CoreML编译），速度与MobileNetV2x1.4（1.6毫秒，74.7% Top-1）相当；而最大的模型EfficientFormer-L7则以仅7.0毫秒的延迟获得了83.3%的准确率。我们的工作证明，经过合理设计的Transformer能够在保持高性能的同时，在移动设备上实现极低的延迟。\n\u003C\u002Fdetails>\n\n\n\u003Cbr>\n\n\n\n## ImageNet-1K上的分类\n\n### 模型\n\n| 模型 | Top-1 (300\u002F450) | 参数量 | MACs | 延迟 | ckpt | ONNX | CoreML |\n|:---------------|:----:|:---:|:--:|:--:|:--:|:--:|:--:|\n| EfficientFormerV2-S0 |   75.7 \u002F 76.2   |     3.5M    |   0.40B   |      0.9ms     |  [S0](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1PXb7b9pv9ZB4cfkRkYEdwgWuVwvEiazq\u002Fview?usp=share_link)    |   [S0](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1xWev98ENruLnnxgFXORmrYzNG5Y8b8y6\u002Fview?usp=share_link)   |    [S0](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F19G3RGcH42gqPBa42CV3yIOmSmVVFqW0X\u002Fview?usp=share_link)    |\n| EfficientFormerV2-S1 |   79.0 \u002F 79.7   |     6.1M    |   0.65B   |      1.1ms     |   [S1](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1EKe1vt-3mG7iceVIMaET_DyISzVTJMn8\u002Fview?usp=share_link)   |   [S1](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1f4eYkY3Tkmyn_GrDk4QqbpWYcF07CukT\u002Fview?usp=share_link)   |    [S1](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1EXI0uq3yt0KpMlItjJlnghYfAzWgdbRj\u002Fview?usp=share_link)    |\n| EfficientFormerV2-S2 |   81.6 \u002F 82.0   |    12.6M   |   1.25B   |      1.6ms     |   [S2](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1gjbFyB5T_yAkmzHNuXEljqScYVQZafMQ\u002Fview?usp=share_link)   |   [S2](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1kJj2UxUQR-ro4WslcnsukcJF9BXi0FMC\u002Fview?usp=share_link)   |    [S2](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1KQw7UMujsHrLUCDOY-pO6rM7zfp7cpDY\u002Fview?usp=share_link)    |\n| EfficientFormerV2-L |   83.3 \u002F 83.5   |    26.1M    |   2.56B   |      2.7ms     |  [L](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1sRXNBHl_ewHBMwwYZVsOJo1k6JpcNJn-\u002Fview?usp=share_link)    |   [L](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F18GfCWWdYYcEz_AOmoO6J7dW8xMtkIpcm\u002Fview?usp=share_link)   |     [L](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1Ynu7fTbqPEW9tSVZdR7ZAN1edUFAocGT\u002Fview?usp=share_link)   |\n\n\n\n| 模型 | Top-1 准确率 | 延迟 | Pytorch 检查点 | CoreML | ONNX |\n| :------------ | :--: | :---: | :---: |:---: | :---: |\n| EfficientFormer-L1 |79.2 (80.2) | 1.6ms| [L1-300](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1wtEmkshLFEYFsX5YhBttBOGYaRvDR7nu\u002Fview?usp=sharing) ([L1-1000](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F11SbX-3cfqTOc247xKYubrAjBiUmr818y\u002Fview?usp=sharing)) | [L1](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1MEDcyeKCBmrgVGrHX8wew3l4ge2CWdok\u002Fview?usp=sharing) | [L1](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F10NMPW8SLLiTa2jwTTuILDQRUzMvehmUM\u002Fview?usp=sharing) |\n| EfficientFormer-L3 |82.4 | 3.0ms| [L3](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1OyyjKKxDyMj-BcfInp4GlDdwLu3hc30m\u002Fview?usp=sharing) | [L3](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F12xb0_6pPAy0OWdW39seL9TStIqKyguEj\u002Fview?usp=sharing) | [L3](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1DEbsOEzP4ljS6-ka86BtwQWiVxkylCaX\u002Fview?usp=sharing) |\n| EfficientFormer-L7 |83.3  | 7.0ms| [L7](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1cVw-pctJwgvGafeouynqWWCwgkcoFMM5\u002Fview?usp=sharing) | [L7](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1CnhAyfylpvvebT9Yn3qF8vrUFjZjuO3F\u002Fview?usp=sharing) | [L7](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1u6But9JQ9Wd7vlaFTGcYm5FiGnQ8y9eS\u002Fview?usp=sharing) |\n\n\n\n## 延迟测量\n\nEfficientFormerV2 在 iPhone 12（iOS 16）上报告的延迟使用了 [XCode 14](https:\u002F\u002Fdeveloper.apple.com\u002Fvideos\u002Fplay\u002Fwwdc2022\u002F10027\u002F) 中的基准测试工具。\n\n对于 EfficientFormerV1，我们使用了 [coreml-performance](https:\u002F\u002Fgithub.com\u002Fvladimir-chernykh\u002Fcoreml-performance)。感谢其出色的延迟测量实现！\n\n*提示*: 要复现报告的速度，需要 macOS + Xcode 以及一台移动设备（iPhone 12）。\n\n\n\n## ImageNet  \n\n### 先决条件\n建议使用 `conda` 虚拟环境。\n```\nconda install pytorch torchvision cudatoolkit=11.3 -c pytorch\npip install timm\npip install submitit\n```\n\n### 数据准备\n\n从 http:\u002F\u002Fimage-net.org\u002F 下载并解压 ImageNet 的训练和验证图像。训练数据应放在 `train` 文件夹中，验证数据应放在 `val` 文件夹中：\n```\n|-- \u002Fpath\u002Fto\u002Fimagenet\u002F\n    |-- train\n    |-- val\n```\n\n### 单机多 GPU 训练\n\n我们提供了一个使用 PyTorch 分布式数据并行（DDP）的示例训练脚本 `dist_train.sh`。\n\n要在一台 8-GPU 机器上训练 EfficientFormer-L1：\n\n```\nsh dist_train.sh efficientformer_l1 8\n```\n\n提示：请在脚本中指定您的数据路径和实验名称！\n\n### 多节点训练\n\n在 Slurm 管理的集群上，可以通过 [submitit](https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002Fsubmitit) 启动多节点训练，例如：\n\n```\nsh slurm_train.sh efficientformer_l1\n```\n\n提示：请根据您的资源情况，在脚本中指定每个节点的 GPU\u002FCPU\u002F内存数量！\n\n### 测试 \n\n我们提供了一个使用 PyTorch 分布式数据并行（DDP）的示例测试脚本 `dist_test.sh`。\n例如，要在一台 8-GPU 机器上测试 EfficientFormer-L1：\n\n```\nsh dist_test.sh efficientformer_l1 8 weights\u002Fefficientformer_l1_300d.pth\n```\n\n## 将 EfficientFormer 用作骨干网络\n[目标检测与实例分割](detection\u002FREADME.md)\u003Cbr>\n[语义分割](segmentation\u002FREADME.md)\n## 致谢\n\n分类（ImageNet）代码库部分基于 [LeViT](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FLeViT) 和 [PoolFormer](https:\u002F\u002Fgithub.com\u002Fsail-sg\u002Fpoolformer) 构建。\n\n检测和分割流程来自 [MMCV](https:\u002F\u002Fgithub.com\u002Fopen-mmlab\u002Fmmcv)（[MMDetection](https:\u002F\u002Fgithub.com\u002Fopen-mmlab\u002Fmmdetection) 和 [MMSegmentation](https:\u002F\u002Fgithub.com\u002Fopen-mmlab\u002Fmmsegmentation)）。\n\n感谢这些优秀的实现！ \n\n## 引用\n\n如果您在工作中使用了我们的代码或模型，请引用 EfficientFormer（NeurIPS 2022）和 EfficientFormerV2（ICCV 2023）：\n```BibTeX\n@article{li2022efficientformer,\n  title={Efficientformer: Vision transformers at mobilenet speed},\n  author={Li, Yanyu and Yuan, Geng and Wen, Yang and Hu, Ju and Evangelidis, Georgios and Tulyakov, Sergey and Wang, Yanzhi and Ren, Jian},\n  journal={Advances in Neural Information Processing Systems},\n  volume={35},\n  pages={12934--12949},\n  year={2022}\n}\n```\n```BibTeX\n@inproceedings{li2022rethinking,\n  title={Rethinking Vision Transformers for MobileNet Size and Speed},\n  author={Li, Yanyu and Hu, Ju and Wen, Yang and Evangelidis, Georgios and Salahi, Kamyar and Wang, Yanzhi and Tulyakov, Sergey and Ren, Jian},\n  booktitle={Proceedings of the IEEE international conference on computer vision},\n  year={2023}\n}\n```","# EfficientFormer 快速上手指南\n\nEfficientFormer 系列模型旨在让 Vision Transformer (ViT) 在移动设备上达到与 MobileNet 相当的推理速度和参数量，同时保持更高的精度。本指南涵盖 EfficientFormerV2 及前代版本的快速部署流程。\n\n## 1. 环境准备\n\n### 系统要求\n- **操作系统**: Linux (推荐) 或 macOS\n- **Python**: 3.8+\n- **GPU**: NVIDIA GPU (用于训练和加速推理)，需安装对应版本的 CUDA\n- **移动端部署测试**: 如需复现论文中的延迟数据，需配备 iPhone 12 (iOS 16) 及 macOS + XCode 环境。\n\n### 前置依赖\n建议使用 `conda` 创建虚拟环境以避免依赖冲突。\n\n```bash\n# 创建并激活虚拟环境\nconda create -n efficientformer python=3.8 -y\nconda activate efficientformer\n\n# 安装 PyTorch 及相关工具 (根据实际 CUDA 版本调整，此处以 11.3 为例)\n# 国内用户推荐使用清华源加速\npip install torch torchvision cudatoolkit=11.3 -c pytorch -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n\n# 安装核心依赖\npip install timm submitit -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n\n# 若需进行 CoreML 转换或性能分析 (macOS 环境)\npip install coremltools==5.2\n```\n\n## 2. 安装步骤\n\n本项目主要作为代码库使用，无需执行复杂的 `setup.py` 安装，克隆仓库即可直接使用。\n\n```bash\n# 克隆仓库\ngit clone https:\u002F\u002Fgithub.com\u002Fsnap-research\u002FEfficientFormer.git\ncd EfficientFormer\n\n# (可选) 如果需要使用检测或分割任务，请确保已安装 MMCV, MMDetection, MMSegmentation\n# 参考官方 detection\u002FREADME.md 和 segmentation\u002FREADME.md\n```\n\n## 3. 基本使用\n\n### 3.1 模型推理与格式转换\n项目提供了工具箱 `toolbox.py` 用于加载预训练权重并进行模型导出（ONNX 或 CoreML）。\n\n**示例：将 EfficientFormerV2-L 模型转换为 ONNX 和 CoreML 格式**\n\n```bash\npython toolbox.py --model efficientformerv2_l --ckpt weights\u002Feformer_l_450.pth --onnx --coreml\n```\n*注意：请确保已下载对应的 `.pth` 预训练权重文件并放置在 `weights\u002F` 目录下。*\n\n### 3.2 ImageNet 分类测试\n下载并准备好 ImageNet 数据集，目录结构如下：\n```text\n|-- \u002Fpath\u002Fto\u002Fimagenet\u002F\n    |-- train\n    |-- val\n```\n\n**单机多卡测试示例 (8 张 GPU)**\n使用提供的脚本对 `EfficientFormer-L1` 进行测试：\n\n```bash\nsh dist_test.sh efficientformer_l1 8 weights\u002Fefficientformer_l1_300d.pth\n```\n*提示：使用前请编辑 `dist_test.sh` 脚本，指定正确的数据路径 (`--data-path`)。*\n\n### 3.3 模型训练\n**单机多卡训练示例 (8 张 GPU)**\n以训练 `EfficientFormer-L1` 为例：\n\n```bash\nsh dist_train.sh efficientformer_l1 8\n```\n*提示：务必在运行前修改 `dist_train.sh` 中的数据集路径和实验名称配置。*\n\n**多节点集群训练 (Slurm)**\n若在使用 Slurm 管理的集群上，可使用 `submitit` 启动训练：\n\n```bash\nsh slurm_train.sh efficientformer_l1\n```\n*提示：请根据集群资源在脚本中调整 GPU\u002FCPU\u002F内存分配参数。*\n\n### 3.4 作为骨干网络使用\nEfficientFormer 可轻松集成到下游任务中：\n- **目标检测与实例分割**: 参考 `detection\u002FREADME.md` (基于 MMDetection)\n- **语义分割**: 参考 `segmentation\u002FREADME.md` (基于 MMSegmentation)","某电商团队正在开发一款面向全球用户的移动端实时商品识别功能，需要在用户摄像头画面中毫秒级定位并分类商品。\n\n### 没有 EfficientFormer 时\n- **推理延迟高**：部署传统的 Vision Transformer 模型在 iPhone 等老旧机型上延迟超过 100ms，导致取景框画面卡顿，用户体验极差。\n- **模型体积过大**：为了保证精度不得不使用大参数量模型，安装包体积激增，严重影响用户在弱网环境下的下载转化率。\n- **功耗与发热严重**：复杂的注意力机制计算量大，长时间开启摄像头识别会导致手机迅速发热并消耗大量电量。\n- **精度与速度难兼得**：若强行替换为轻量级 CNN（如 MobileNet），虽然速度达标，但商品细粒度分类的准确率下降明显，误识率升高。\n\n### 使用 EfficientFormer 后\n- **端侧极速响应**：利用 EfficientFormerV2 在 iPhone 12 上实现了与 MobileNet 相当的毫秒级低延迟，画面流畅无感知，实时交互体验大幅提升。\n- **极致轻量化部署**：模型参数量压缩至移动网级别，显著减小了应用包体积，同时保持了比 MobileNetV2 高出约 4% 的 Top-1 准确率。\n- **能效比优化**：重新设计的架构大幅降低了计算复杂度，长时间运行下设备发热明显减少，电池续航能力得到保障。\n- **兼顾性能与效率**：无需在精度和速度之间做妥协，既保留了 Transformer 强大的特征提取能力，又满足了移动端严苛的资源限制。\n\nEfficientFormer 成功打破了视觉大模型难以在移动端落地的瓶颈，让高精度商品识别在普通手机上也能跑得飞快且省电。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fsnap-research_EfficientFormer_bbeda11f.png","snap-research","Snap Research","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fsnap-research_117fe63a.png","",null,"https:\u002F\u002Fresearch.snap.com\u002F","https:\u002F\u002Fgithub.com\u002Fsnap-research",[81,85],{"name":82,"color":83,"percentage":84},"Python","#3572A5",99.1,{"name":86,"color":87,"percentage":88},"Shell","#89e051",0.9,1111,94,"2026-03-30T08:09:31","NOASSERTION","Linux, macOS","训练需要 NVIDIA GPU（示例为 8 卡多 GPU 环境），需安装 cudatoolkit=11.3；推理部署在 iPhone (iOS) 或 macOS 上可使用 CoreML，无需 NVIDIA GPU。","未说明（多节点训练脚本中提示需根据资源指定内存）",{"notes":97,"python":98,"dependencies":99},"1. 官方推荐使用 conda 管理环境。2. 延迟测试复现需要 macOS + XCode 环境及 iPhone 12 真机。3. 模型导出支持 ONNX 和 CoreML 格式。4. 下游任务（检测、分割）依赖 MMCV、MMDetection 和 MMSegmentation。5. 训练脚本支持单机多卡 (DDP) 和 Slurm 多节点集群。","未说明（建议使用 conda 虚拟环境）",[100,101,102,103,104,105,106],"pytorch","torchvision","cudatoolkit==11.3","timm","submitit","coremltools==5.2","torch==1.11",[35,15,14],[109,110,111,112,100,113,114,115,116,117],"deep-learning","detection","efficient-inference","efficient-neural-networks","semantic-segmentation","transformer","imagenet","transformers","mobile-devices","2026-03-27T02:49:30.150509","2026-04-07T10:51:36.398782",[121,126,131,136,141,146,151],{"id":122,"question_zh":123,"answer_zh":124,"source_url":125},21811,"如何修改 EfficientFormerV2 以训练非标准分辨率（如 64x64 或 112x112）的图像？","修改输入分辨率时，必须同步调整注意力模块（Attention Module）中的分辨率参数配置。仅仅改变输入图像大小而不更新模型内部关于特征图尺寸的设定会导致无效或错误。需检查配置文件中与 `resolution` 相关的参数并确保其与输入尺寸匹配。","https:\u002F\u002Fgithub.com\u002Fsnap-research\u002FEfficientFormer\u002Fissues\u002F44",{"id":127,"question_zh":128,"answer_zh":129,"source_url":130},21805,"为什么在 CPU 和 GPU 上，EfficientFormer 的 Patch Embedding（两个 3x3 卷积）比 PoolFormer 的（一个 7x7 卷积）更慢？","这是正常现象。在服务器端的 CPU 和 GPU 上使用 PyTorch 时，两个连续的 3x3 卷积操作确实比单个 7x7 卷积操作要慢。虽然 3x3 卷积通常在移动端更友好，但在桌面级硬件上，大核卷积往往具有更好的优化和更快的推理速度。","https:\u002F\u002Fgithub.com\u002Fsnap-research\u002FEfficientFormer\u002Fissues\u002F30",{"id":132,"question_zh":133,"answer_zh":134,"source_url":135},21806,"为什么我在 iPhone 上测试的 MobileNetV2 延迟与论文中的数据不一致？","差异通常源于 CoreML 模型的版本。从 Apple Model Zoo 下载的旧版 `MobileNetV2.mlmodel` 未经过最新优化。建议手动导出最新的 mlmodel 文件进行测试。例如，更新后的 MobileNetV2 x1.0 在 iPhone 12 上的延迟可降至 1.3ms，而 x1.4 版本约为 1.6ms。CoreML 的版本和编译器优化对推理速度有重大影响。","https:\u002F\u002Fgithub.com\u002Fsnap-research\u002FEfficientFormer\u002Fissues\u002F9",{"id":137,"question_zh":138,"answer_zh":139,"source_url":140},21807,"EfficientFormer 报告的准确率数据是基于知识蒸馏（Distillation）训练的吗？","是的，官方发布的模型准确率（例如 L1 版本的 79.2%）是基于知识蒸馏训练 300 个 epoch 得到的结果。目前官方尚未提供不使用蒸馏训练的模型数据，因此如果复现时未使用蒸馏，准确率可能会低 2-3 个百分点。","https:\u002F\u002Fgithub.com\u002Fsnap-research\u002FEfficientFormer\u002Fissues\u002F15",{"id":142,"question_zh":143,"answer_zh":144,"source_url":145},21808,"如何在 Hugging Face Transformers 库中使用 EfficientFormer 模型？","EfficientFormer V1 和 V2 已被集成到 Hugging Face Transformers 库中。您可以直接从 Hugging Face Hub 的 'snap-research' 组织下加载模型权重和配置文件。社区成员已通过 PR 将模型合并至主库，支持直接通过 `transformers` 接口调用。","https:\u002F\u002Fgithub.com\u002Fsnap-research\u002FEfficientFormer\u002Fissues\u002F37",{"id":147,"question_zh":148,"answer_zh":149,"source_url":150},21809,"在 Jetson Nano 等边缘设备上运行 EfficientFormer 的 ONNX 模型时，为什么延迟表现不如预期？","这可能与 TensorRT 对某些算子的支持有限有关，特别是 GeLU 激活函数。在 Jetson Nano 等旧设备上，缺乏针对这些算子的优化会导致推理速度下降。建议在更新的硬件（如 Jetson NX）上测试，或检查 TensorRT 版本是否支持模型中的所有操作。","https:\u002F\u002Fgithub.com\u002Fsnap-research\u002FEfficientFormer\u002Fissues\u002F10",{"id":152,"question_zh":153,"answer_zh":154,"source_url":155},21810,"使用 EfficientFormer 进行语义分割时效果不正确，可能是什么原因？","请确认您使用的是预训练的 ADE20K 权重还是在自定义数据集（如 Mapillary）上重新训练的模型。如果直接使用预训练模型推理自定义数据集，由于类别和分布差异，分割结果会不准确。需要针对特定数据集进行微调训练。","https:\u002F\u002Fgithub.com\u002Fsnap-research\u002FEfficientFormer\u002Fissues\u002F26",[]]