[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-rwightman--gen-efficientnet-pytorch":3,"tool-rwightman--gen-efficientnet-pytorch":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":78,"owner_email":77,"owner_twitter":79,"owner_website":80,"owner_url":81,"languages":82,"stars":87,"forks":88,"last_commit_at":89,"license":90,"difficulty_score":91,"env_os":92,"env_gpu":93,"env_ram":92,"env_deps":94,"category_tags":101,"github_topics":102,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":109,"updated_at":110,"faqs":111,"releases":141},4715,"rwightman\u002Fgen-efficientnet-pytorch","gen-efficientnet-pytorch","Pretrained EfficientNet, EfficientNet-Lite, MixNet, MobileNetV3 \u002F V2, MNASNet A1 and B1, FBNet, Single-Path NAS","gen-efficientnet-pytorch 是一个基于 PyTorch 的开源项目，旨在提供 EfficientNet、MobileNetV3、MixNet 等多种高效卷积神经网络的通用实现。它主要解决了开发者在复现和应用这些通过自动神经架构搜索（NAS）得出的先进模型时，面临的代码分散、配置复杂及预训练权重难以获取等痛点。\n\n该项目非常适合计算机视觉领域的研究人员和深度学习工程师使用，特别是那些需要在移动端或资源受限设备上部署高精度图像分类模型的用户。其核心技术亮点在于采用了一套灵活的字符串定义系统来配置网络块布局，使得同一套代码框架能够轻松衍生出多种变体架构。此外，gen-efficientnet-pytorch 集成了大量经过精心调优的预训练权重（包括 RandAugment 和 AdvProp 训练版本），并提供了对 TorchScript 和 ONNX 导出的良好支持，方便模型进行脚本化优化及跨平台部署。\n\n值得注意的是，目前该仓库已停止主动维护，官方建议用户转向功能更全面且持续更新的 `timm` 库，但 gen-efficientnet-pytorch 中经典的模型","gen-efficientnet-pytorch 是一个基于 PyTorch 的开源项目，旨在提供 EfficientNet、MobileNetV3、MixNet 等多种高效卷积神经网络的通用实现。它主要解决了开发者在复现和应用这些通过自动神经架构搜索（NAS）得出的先进模型时，面临的代码分散、配置复杂及预训练权重难以获取等痛点。\n\n该项目非常适合计算机视觉领域的研究人员和深度学习工程师使用，特别是那些需要在移动端或资源受限设备上部署高精度图像分类模型的用户。其核心技术亮点在于采用了一套灵活的字符串定义系统来配置网络块布局，使得同一套代码框架能够轻松衍生出多种变体架构。此外，gen-efficientnet-pytorch 集成了大量经过精心调优的预训练权重（包括 RandAugment 和 AdvProp 训练版本），并提供了对 TorchScript 和 ONNX 导出的良好支持，方便模型进行脚本化优化及跨平台部署。\n\n值得注意的是，目前该仓库已停止主动维护，官方建议用户转向功能更全面且持续更新的 `timm` 库，但 gen-efficientnet-pytorch 中经典的模型定义思路和权重资源依然具有重要的参考和使用价值。","# (Generic) EfficientNets for PyTorch\n\n```diff\n-- **NOTE** This repo is not being maintained --\n```\nPlease use [`timm`](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fpytorch-image-models) instead. It includes all of these model definitions (compatible weights) and much much more.\n\nA 'generic' implementation of EfficientNet, MixNet, MobileNetV3, etc. that covers most of the compute\u002Fparameter efficient architectures derived from the MobileNet V1\u002FV2 block sequence, including those found via automated neural architecture search. \n\nAll models are implemented by GenEfficientNet or MobileNetV3 classes, with string based architecture definitions to configure the block layouts (idea from [here](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Fblob\u002Fmaster\u002Fmodels\u002Fofficial\u002Fmnasnet\u002Fmnasnet_models.py))\n\n## What's New\n\n### Aug 19, 2020\n* Add updated PyTorch trained EfficientNet-B3 weights trained by myself with `timm` (82.1 top-1)\n* Add PyTorch trained EfficientNet-Lite0 contributed by [@hal-314](https:\u002F\u002Fgithub.com\u002Fhal-314) (75.5 top-1)\n* Update ONNX and Caffe2 export \u002F utility scripts to work with latest PyTorch \u002F ONNX\n* ONNX runtime based validation script added\n* activations (mostly) brought in sync with `timm` equivalents\n\n\n### April 5, 2020\n* Add some newly trained MobileNet-V2 models trained with latest h-params, rand augment. They compare quite favourably to EfficientNet-Lite\n  * 3.5M param MobileNet-V2 100 @ 73%\n  * 4.5M param MobileNet-V2 110d @ 75%\n  * 6.1M param MobileNet-V2 140 @ 76.5%\n  * 5.8M param MobileNet-V2 120d @ 77.3%\n  \n### March 23, 2020\n * Add EfficientNet-Lite models w\u002F weights ported from [Tensorflow TPU](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet\u002Flite)\n * Add PyTorch trained MobileNet-V3 Large weights with 75.77% top-1\n * IMPORTANT CHANGE (if training from scratch) - weight init changed to better match Tensorflow impl, set `fix_group_fanout=False` in `initialize_weight_goog` for old behavior\n\n### Feb 12, 2020\n * Add EfficientNet-L2 and B0-B7 NoisyStudent weights ported from [Tensorflow TPU](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet)\n * Port new EfficientNet-B8 (RandAugment) weights from TF TPU, these are different than the B8 AdvProp, different input normalization.\n * Add RandAugment PyTorch trained EfficientNet-ES (EdgeTPU-Small) weights with 78.1 top-1. Trained by [Andrew Lavin](https:\u002F\u002Fgithub.com\u002Fandravin)\n\n### Jan 22, 2020\n * Update weights for EfficientNet B0, B2, B3 and MixNet-XL with latest RandAugment trained weights. Trained with (https:\u002F\u002Fgithub.com\u002Frwightman\u002Fpytorch-image-models)\n * Fix torchscript compatibility for PyTorch 1.4, add torchscript support for MixedConv2d using ModuleDict\n * Test models, torchscript, onnx export with PyTorch 1.4 -- no issues\n\n### Nov 22, 2019\n * New top-1 high! Ported official TF EfficientNet AdvProp (https:\u002F\u002Farxiv.org\u002Fabs\u002F1911.09665) weights and B8 model spec. Created a new set of `ap` models since they use a different\n preprocessing (Inception mean\u002Fstd) from the original EfficientNet base\u002FAA\u002FRA weights.\n \n### Nov 15, 2019\n * Ported official TF MobileNet-V3 float32 large\u002Fsmall\u002Fminimalistic weights\n * Modifications to MobileNet-V3 model and components to support some additional config needed for differences between TF MobileNet-V3 and mine\n\n### Oct 30, 2019\n * Many of the models will now work with torch.jit.script, MixNet being the biggest exception\n * Improved interface for enabling torchscript or ONNX export compatible modes (via config)\n * Add JIT optimized mem-efficient Swish\u002FMish autograd.fn in addition to memory-efficient autgrad.fn\n * Activation factory to select best version of activation by name or override one globally\n * Add pretrained checkpoint load helper that handles input conv and classifier changes\n \n### Oct 27, 2019\n * Add CondConv EfficientNet variants ported from https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet\u002Fcondconv\n * Add RandAug weights for TF EfficientNet B5 and B7 from https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet\n * Bring over MixNet-XL model and depth scaling algo from my pytorch-image-models code base\n * Switch activations and global pooling to modules\n * Add memory-efficient Swish\u002FMish impl\n * Add as_sequential() method to all models and allow as an argument in entrypoint fns\n * Move MobileNetV3 into own file since it has a different head\n * Remove ChamNet, MobileNet V2\u002FV1 since they will likely never be used here\n\n## Models\n\nImplemented models include:\n  * EfficientNet NoisyStudent (B0-B7, L2) (https:\u002F\u002Farxiv.org\u002Fabs\u002F1911.04252)\n  * EfficientNet AdvProp (B0-B8) (https:\u002F\u002Farxiv.org\u002Fabs\u002F1911.09665)\n  * EfficientNet (B0-B8) (https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.11946)\n  * EfficientNet-EdgeTPU (S, M, L) (https:\u002F\u002Fai.googleblog.com\u002F2019\u002F08\u002Fefficientnet-edgetpu-creating.html)\n  * EfficientNet-CondConv (https:\u002F\u002Farxiv.org\u002Fabs\u002F1904.04971)\n  * EfficientNet-Lite (https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet\u002Flite)\n  * MixNet (https:\u002F\u002Farxiv.org\u002Fabs\u002F1907.09595)\n  * MNASNet B1, A1 (Squeeze-Excite), and Small (https:\u002F\u002Farxiv.org\u002Fabs\u002F1807.11626)\n  * MobileNet-V3 (https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.02244)\n  * FBNet-C (https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.03443)\n  * Single-Path NAS (https:\u002F\u002Farxiv.org\u002Fabs\u002F1904.02877)\n    \nI originally implemented and trained some these models with code [here](https:\u002F\u002Fgithub.com\u002Frwightman\u002Fpytorch-image-models), this repository contains just the GenEfficientNet models, validation, and associated ONNX\u002FCaffe2 export code. \n\n## Pretrained\n\nI've managed to train several of the models to accuracies close to or above the originating papers and official impl. My training code is here: https:\u002F\u002Fgithub.com\u002Frwightman\u002Fpytorch-image-models\n\n\n|Model | Prec@1 (Err) | Prec@5 (Err) | Param#(M) | MAdds(M) | Image Scaling | Resolution | Crop |\n|---|---|---|---|---|---|---|---|\n| efficientnet_b3 | 82.240 (17.760) | 96.116 (3.884) | 12.23 | TBD | bicubic | 320 | 1.0 |\n| efficientnet_b3 | 82.076 (17.924) | 96.020 (3.980) | 12.23 | TBD | bicubic | 300 | 0.904 |\n| mixnet_xl | 81.074 (18.926) | 95.282 (4.718) | 11.90 | TBD | bicubic | 256 | 1.0 |\n| efficientnet_b2 | 80.612 (19.388) | 95.318 (4.682) | 9.1 | TBD | bicubic | 288 | 1.0 |\n| mixnet_xl | 80.476 (19.524) | 94.936 (5.064) | 11.90 | TBD | bicubic | 224 | 0.875 |\n| efficientnet_b2 | 80.288 (19.712) | 95.166 (4.834) | 9.1 | 1003 | bicubic | 260 | 0.890 |\n| mixnet_l | 78.976 (21.024 | 94.184 (5.816) | 7.33 | TBD | bicubic | 224 | 0.875 |\n| efficientnet_b1 | 78.692 (21.308) | 94.086 (5.914) | 7.8 | 694 | bicubic | 240 | 0.882 |\n| efficientnet_es | 78.066 (21.934) | 93.926 (6.074) | 5.44 | TBD | bicubic | 224 | 0.875 |\n| efficientnet_b0 | 77.698 (22.302) | 93.532 (6.468) | 5.3 | 390 | bicubic | 224 | 0.875 |\n| mobilenetv2_120d | 77.294 (22.706 | 93.502 (6.498) | 5.8 | TBD | bicubic | 224 | 0.875 |\n| mixnet_m | 77.256 (22.744) | 93.418 (6.582) | 5.01 | 353 | bicubic | 224 | 0.875 |\n| mobilenetv2_140 | 76.524 (23.476) | 92.990 (7.010) | 6.1 | TBD | bicubic | 224 | 0.875 |\n| mixnet_s | 75.988 (24.012) | 92.794 (7.206) | 4.13 | TBD | bicubic | 224 | 0.875 |\n| mobilenetv3_large_100 | 75.766 (24.234) | 92.542 (7.458) | 5.5 | TBD | bicubic | 224 | 0.875 |\n| mobilenetv3_rw | 75.634 (24.366) | 92.708 (7.292) | 5.5 | 219 | bicubic | 224 | 0.875 |\n| efficientnet_lite0 | 75.472 (24.528) | 92.520 (7.480) | 4.65 | TBD | bicubic | 224 | 0.875 |\n| mnasnet_a1 | 75.448 (24.552) | 92.604 (7.396) | 3.9 | 312 | bicubic | 224 | 0.875 |\n| fbnetc_100 | 75.124 (24.876) | 92.386 (7.614) | 5.6 | 385 | bilinear | 224 | 0.875 |\n| mobilenetv2_110d | 75.052 (24.948) | 92.180 (7.820) | 4.5 | TBD | bicubic | 224 | 0.875 |\n| mnasnet_b1 | 74.658 (25.342) | 92.114 (7.886) | 4.4 | 315 | bicubic | 224 | 0.875 |\n| spnasnet_100 | 74.084 (25.916)  | 91.818 (8.182) | 4.4 | TBD | bilinear | 224 | 0.875 |\n| mobilenetv2_100 | 72.978 (27.022) | 91.016 (8.984) | 3.5 | TBD | bicubic | 224 | 0.875 |\n\n\nMore pretrained models to come...\n\n\n## Ported Weights\n\nThe weights ported from Tensorflow checkpoints for the EfficientNet models do pretty much match accuracy in Tensorflow once a SAME convolution padding equivalent is added, and the same crop factors, image scaling, etc (see table) are used via cmd line args.\n\n**IMPORTANT:** \n* Tensorflow ported weights for EfficientNet AdvProp (AP), EfficientNet EdgeTPU, EfficientNet-CondConv, EfficientNet-Lite, and MobileNet-V3 models use Inception style (0.5, 0.5, 0.5) for mean and std.\n* Enabling the Tensorflow preprocessing pipeline with `--tf-preprocessing` at validation time will improve scores by 0.1-0.5%, very close to original TF impl.\n\nTo run validation for tf_efficientnet_b5:\n`python validate.py \u002Fpath\u002Fto\u002Fimagenet\u002Fvalidation\u002F --model tf_efficientnet_b5 -b 64 --img-size 456 --crop-pct 0.934 --interpolation bicubic`\n\nTo run validation w\u002F TF preprocessing for tf_efficientnet_b5:\n`python validate.py \u002Fpath\u002Fto\u002Fimagenet\u002Fvalidation\u002F --model tf_efficientnet_b5 -b 64 --img-size 456 --tf-preprocessing`\n\nTo run validation for a model with Inception preprocessing, ie EfficientNet-B8 AdvProp:\n`python validate.py \u002Fpath\u002Fto\u002Fimagenet\u002Fvalidation\u002F --model tf_efficientnet_b8_ap -b 48 --num-gpu 2 --img-size 672 --crop-pct 0.954 --mean 0.5 --std 0.5`\n\n|Model | Prec@1 (Err) | Prec@5 (Err) | Param # | Image Scaling  | Image Size | Crop | \n|---|---|---|---|---|---|---|\n| tf_efficientnet_l2_ns *tfp | 88.352 (11.648) | 98.652 (1.348) | 480 | bicubic | 800 | N\u002FA |\n| tf_efficientnet_l2_ns      | TBD | TBD | 480 | bicubic | 800 | 0.961 |\n| tf_efficientnet_l2_ns_475      | 88.234 (11.766) | 98.546 (1.454) | 480 | bicubic | 475 | 0.936 |\n| tf_efficientnet_l2_ns_475 *tfp | 88.172 (11.828) | 98.566 (1.434) | 480 | bicubic | 475 | N\u002FA |\n| tf_efficientnet_b7_ns *tfp | 86.844 (13.156) | 98.084 (1.916) | 66.35 | bicubic | 600 | N\u002FA |\n| tf_efficientnet_b7_ns      | 86.840 (13.160) | 98.094 (1.906) | 66.35 | bicubic | 600 | N\u002FA |\n| tf_efficientnet_b6_ns      | 86.452 (13.548) | 97.882 (2.118) | 43.04 | bicubic | 528 | N\u002FA |\n| tf_efficientnet_b6_ns *tfp | 86.444 (13.556) | 97.880 (2.120) | 43.04 | bicubic | 528 | N\u002FA |\n| tf_efficientnet_b5_ns *tfp | 86.064 (13.936) | 97.746 (2.254) | 30.39 | bicubic | 456 | N\u002FA |\n| tf_efficientnet_b5_ns      | 86.088 (13.912) | 97.752 (2.248) | 30.39 | bicubic | 456 | N\u002FA |\n| tf_efficientnet_b8_ap *tfp | 85.436 (14.564) | 97.272 (2.728) | 87.4 | bicubic | 672 | N\u002FA |\n| tf_efficientnet_b8 *tfp    | 85.384 (14.616) | 97.394 (2.606) | 87.4 | bicubic | 672 | N\u002FA |\n| tf_efficientnet_b8         | 85.370 (14.630) | 97.390 (2.610) | 87.4 | bicubic | 672 | 0.954 |\n| tf_efficientnet_b8_ap      | 85.368 (14.632) | 97.294 (2.706) | 87.4 | bicubic | 672 | 0.954 |\n| tf_efficientnet_b4_ns *tfp | 85.298 (14.702) | 97.504 (2.496) | 19.34 | bicubic | 380 | N\u002FA |\n| tf_efficientnet_b4_ns      | 85.162 (14.838) | 97.470 (2.530) | 19.34 | bicubic | 380 | 0.922 |\n| tf_efficientnet_b7_ap *tfp | 85.154 (14.846) | 97.244 (2.756) | 66.35 | bicubic | 600 | N\u002FA |\n| tf_efficientnet_b7_ap      | 85.118 (14.882) | 97.252 (2.748) | 66.35 | bicubic | 600 | 0.949 |\n| tf_efficientnet_b7 *tfp | 84.940 (15.060) | 97.214 (2.786) | 66.35 | bicubic | 600 | N\u002FA |\n| tf_efficientnet_b7      | 84.932 (15.068) | 97.208 (2.792) | 66.35 | bicubic | 600 | 0.949 |\n| tf_efficientnet_b6_ap      | 84.786 (15.214) | 97.138 (2.862) | 43.04 | bicubic | 528 | 0.942 |\n| tf_efficientnet_b6_ap *tfp | 84.760 (15.240) | 97.124 (2.876) | 43.04 | bicubic | 528 | N\u002FA |\n| tf_efficientnet_b5_ap *tfp | 84.276 (15.724) | 96.932 (3.068) | 30.39 | bicubic | 456 | N\u002FA |\n| tf_efficientnet_b5_ap      | 84.254 (15.746) | 96.976 (3.024) | 30.39 | bicubic | 456 | 0.934 |\n| tf_efficientnet_b6 *tfp  | 84.140 (15.860) | 96.852 (3.148) | 43.04 | bicubic | 528 | N\u002FA |\n| tf_efficientnet_b6       | 84.110 (15.890) | 96.886 (3.114) | 43.04 | bicubic | 528 | 0.942 |\n| tf_efficientnet_b3_ns *tfp | 84.054 (15.946) | 96.918 (3.082) | 12.23 | bicubic | 300 | N\u002FA |\n| tf_efficientnet_b3_ns      | 84.048 (15.952) | 96.910 (3.090) | 12.23 | bicubic | 300 | .904 |\n| tf_efficientnet_b5 *tfp  | 83.822 (16.178) | 96.756 (3.244) | 30.39 | bicubic | 456 | N\u002FA |\n| tf_efficientnet_b5       | 83.812 (16.188) | 96.748 (3.252) | 30.39 | bicubic | 456 | 0.934 |\n| tf_efficientnet_b4_ap *tfp | 83.278 (16.722) | 96.376 (3.624) | 19.34 | bicubic | 380 | N\u002FA |\n| tf_efficientnet_b4_ap      | 83.248 (16.752) | 96.388 (3.612) | 19.34 | bicubic | 380 | 0.922 |\n| tf_efficientnet_b4       | 83.022 (16.978) | 96.300 (3.700) | 19.34 | bicubic | 380 | 0.922 |\n| tf_efficientnet_b4 *tfp  | 82.948 (17.052) | 96.308 (3.692) | 19.34 | bicubic | 380 | N\u002FA |\n| tf_efficientnet_b2_ns *tfp | 82.436 (17.564) | 96.268 (3.732) | 9.11 | bicubic | 260 | N\u002FA |\n| tf_efficientnet_b2_ns      | 82.380 (17.620) | 96.248 (3.752) | 9.11 | bicubic | 260 | 0.89 |\n| tf_efficientnet_b3_ap *tfp | 81.882 (18.118) | 95.662 (4.338) | 12.23 | bicubic | 300 | N\u002FA |\n| tf_efficientnet_b3_ap      | 81.828 (18.172) | 95.624 (4.376) | 12.23 | bicubic | 300 | 0.904 |\n| tf_efficientnet_b3       | 81.636 (18.364) | 95.718 (4.282) | 12.23 | bicubic | 300 | 0.904 |\n| tf_efficientnet_b3 *tfp  | 81.576 (18.424) | 95.662 (4.338) | 12.23 | bicubic | 300 | N\u002FA |\n| tf_efficientnet_lite4      | 81.528 (18.472) | 95.668 (4.332) | 13.00  | bilinear | 380 | 0.92 |\n| tf_efficientnet_b1_ns *tfp | 81.514 (18.486) | 95.776 (4.224) | 7.79 | bicubic | 240 | N\u002FA |\n| tf_efficientnet_lite4 *tfp | 81.502 (18.498) | 95.676 (4.324) | 13.00  | bilinear | 380 | N\u002FA |\n| tf_efficientnet_b1_ns      | 81.388 (18.612) | 95.738 (4.262) | 7.79 | bicubic | 240 | 0.88 |\n| tf_efficientnet_el       | 80.534 (19.466) | 95.190 (4.810) | 10.59 | bicubic | 300 | 0.904 |\n| tf_efficientnet_el *tfp  | 80.476 (19.524) | 95.200 (4.800) | 10.59 | bicubic | 300 | N\u002FA |\n| tf_efficientnet_b2_ap *tfp | 80.420 (19.580) | 95.040 (4.960) | 9.11 | bicubic | 260 | N\u002FA |\n| tf_efficientnet_b2_ap    | 80.306 (19.694) | 95.028 (4.972) | 9.11 | bicubic | 260 | 0.890 |\n| tf_efficientnet_b2 *tfp  | 80.188 (19.812) | 94.974 (5.026) | 9.11 | bicubic | 260 | N\u002FA |\n| tf_efficientnet_b2       | 80.086 (19.914) | 94.908 (5.092) | 9.11 | bicubic | 260 | 0.890 |\n| tf_efficientnet_lite3       | 79.812 (20.188) | 94.914 (5.086) | 8.20  | bilinear | 300 | 0.904 |\n| tf_efficientnet_lite3 *tfp  | 79.734 (20.266) | 94.838 (5.162) | 8.20  | bilinear | 300 | N\u002FA |\n| tf_efficientnet_b1_ap *tfp | 79.532 (20.468) | 94.378 (5.622) | 7.79 | bicubic | 240 | N\u002FA |\n| tf_efficientnet_cc_b1_8e *tfp | 79.464 (20.536)| 94.492 (5.508) | 39.7 | bicubic | 240 | 0.88 |\n| tf_efficientnet_cc_b1_8e | 79.298 (20.702) | 94.364 (5.636) | 39.7 | bicubic | 240 | 0.88 |\n| tf_efficientnet_b1_ap    | 79.278 (20.722) | 94.308 (5.692) | 7.79 | bicubic | 240 | 0.88 |\n| tf_efficientnet_b1 *tfp  | 79.172 (20.828) | 94.450 (5.550) | 7.79 | bicubic | 240 | N\u002FA |\n| tf_efficientnet_em *tfp  | 78.958 (21.042) | 94.458 (5.542) | 6.90 | bicubic | 240 | N\u002FA |\n| tf_efficientnet_b0_ns *tfp | 78.806 (21.194) | 94.496 (5.504) | 5.29 | bicubic | 224 | N\u002FA |\n| tf_mixnet_l *tfp         | 78.846 (21.154) | 94.212 (5.788) | 7.33 | bilinear | 224 | N\u002FA |\n| tf_efficientnet_b1       | 78.826 (21.174) | 94.198 (5.802) | 7.79 | bicubic | 240 | 0.88 |\n| tf_mixnet_l              | 78.770 (21.230) | 94.004 (5.996) | 7.33 | bicubic | 224 | 0.875 |\n| tf_efficientnet_em       | 78.742 (21.258) | 94.332 (5.668) | 6.90 | bicubic | 240 | 0.875 |\n| tf_efficientnet_b0_ns    | 78.658 (21.342) | 94.376 (5.624) | 5.29 | bicubic | 224 | 0.875 |\n| tf_efficientnet_cc_b0_8e *tfp | 78.314 (21.686) | 93.790 (6.210) | 24.0 | bicubic | 224 | 0.875 |\n| tf_efficientnet_cc_b0_8e | 77.908 (22.092) | 93.656 (6.344) | 24.0 | bicubic | 224 | 0.875 |\n| tf_efficientnet_cc_b0_4e *tfp | 77.746 (22.254) | 93.552 (6.448) | 13.3 | bicubic | 224 | 0.875 |\n| tf_efficientnet_cc_b0_4e | 77.304 (22.696) | 93.332 (6.668) | 13.3 | bicubic | 224 | 0.875 |\n| tf_efficientnet_es *tfp  | 77.616 (22.384) | 93.750 (6.250) | 5.44 | bicubic | 224 | N\u002FA |\n| tf_efficientnet_lite2 *tfp  | 77.544 (22.456) | 93.800 (6.200) | 6.09  | bilinear | 260 | N\u002FA |\n| tf_efficientnet_lite2       | 77.460 (22.540) | 93.746 (6.254) | 6.09  | bicubic | 260 | 0.89 |\n| tf_efficientnet_b0_ap *tfp | 77.514 (22.486) | 93.576 (6.424) | 5.29  | bicubic | 224 | N\u002FA |\n| tf_efficientnet_es       | 77.264 (22.736) | 93.600 (6.400) | 5.44 | bicubic | 224 | N\u002FA |\n| tf_efficientnet_b0 *tfp  | 77.258 (22.742) | 93.478 (6.522) | 5.29  | bicubic | 224 | N\u002FA |\n| tf_efficientnet_b0_ap    | 77.084 (22.916) | 93.254 (6.746) | 5.29  | bicubic | 224 | 0.875 |\n| tf_mixnet_m *tfp         | 77.072 (22.928) | 93.368 (6.632) | 5.01 | bilinear | 224 | N\u002FA |\n| tf_mixnet_m              | 76.950 (23.050) | 93.156 (6.844) | 5.01 | bicubic | 224 | 0.875 |\n| tf_efficientnet_b0       | 76.848 (23.152) | 93.228 (6.772) | 5.29  | bicubic | 224 | 0.875 |\n| tf_efficientnet_lite1 *tfp  | 76.764 (23.236) | 93.326 (6.674) | 5.42  | bilinear | 240 | N\u002FA |\n| tf_efficientnet_lite1       | 76.638 (23.362) | 93.232 (6.768) | 5.42  | bicubic | 240 | 0.882 |\n| tf_mixnet_s *tfp         | 75.800 (24.200) | 92.788 (7.212) | 4.13 | bilinear | 224 | N\u002FA |\n| tf_mobilenetv3_large_100 *tfp | 75.768 (24.232) | 92.710 (7.290) | 5.48 | bilinear | 224 | N\u002FA |\n| tf_mixnet_s              | 75.648 (24.352) | 92.636 (7.364) | 4.13 | bicubic | 224 | 0.875 |\n| tf_mobilenetv3_large_100 | 75.516 (24.484) | 92.600 (7.400) | 5.48 | bilinear | 224 | 0.875 |\n| tf_efficientnet_lite0 *tfp  | 75.074 (24.926) | 92.314 (7.686) | 4.65  | bilinear | 224 | N\u002FA |\n| tf_efficientnet_lite0       | 74.842 (25.158) | 92.170 (7.830) | 4.65  | bicubic | 224 | 0.875 |\n| tf_mobilenetv3_large_075 *tfp | 73.730 (26.270) | 91.616 (8.384) | 3.99 | bilinear | 224 |N\u002FA |\n| tf_mobilenetv3_large_075 | 73.442 (26.558) | 91.352 (8.648) | 3.99 | bilinear | 224 | 0.875 |\n| tf_mobilenetv3_large_minimal_100 *tfp | 72.678 (27.322) | 90.860 (9.140) | 3.92 | bilinear | 224 | N\u002FA |\n| tf_mobilenetv3_large_minimal_100 | 72.244 (27.756) | 90.636 (9.364) | 3.92 | bilinear | 224 | 0.875 |\n| tf_mobilenetv3_small_100 *tfp | 67.918 (32.082) | 87.958 (12.042 | 2.54 | bilinear | 224 | N\u002FA |\n| tf_mobilenetv3_small_100 | 67.918 (32.082) | 87.662 (12.338) | 2.54 | bilinear | 224 | 0.875 |\n| tf_mobilenetv3_small_075 *tfp | 66.142 (33.858) | 86.498 (13.502) | 2.04 | bilinear | 224 | N\u002FA |\n| tf_mobilenetv3_small_075 | 65.718 (34.282) | 86.136 (13.864) | 2.04 | bilinear | 224 | 0.875 |\n| tf_mobilenetv3_small_minimal_100 *tfp | 63.378 (36.622) | 84.802 (15.198) | 2.04 | bilinear | 224 | N\u002FA |\n| tf_mobilenetv3_small_minimal_100 | 62.898 (37.102) | 84.230 (15.770) | 2.04 | bilinear | 224 | 0.875 |\n\n\n*tfp models validated with `tf-preprocessing` pipeline\n\nGoogle tf and tflite weights ported from official Tensorflow repositories\n* https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fmnasnet\n* https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet\n* https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Ftree\u002Fmaster\u002Fresearch\u002Fslim\u002Fnets\u002Fmobilenet\n\n## Usage\n\n### Environment\n\nAll development and testing has been done in Conda Python 3 environments on Linux x86-64 systems, specifically Python 3.6.x, 3.7.x, 3.8.x.\n\nUsers have reported that a Python 3 Anaconda install in Windows works. I have not verified this myself.\n\nPyTorch versions 1.4, 1.5, 1.6 have been tested with this code.\n\nI've tried to keep the dependencies minimal, the setup is as per the PyTorch default install instructions for Conda:\n```\nconda create -n torch-env\nconda activate torch-env\nconda install -c pytorch pytorch torchvision cudatoolkit=10.2\n```\n\n### PyTorch Hub\n\nModels can be accessed via the PyTorch Hub API\n\n```\n>>> torch.hub.list('rwightman\u002Fgen-efficientnet-pytorch')\n['efficientnet_b0', ...]\n>>> model = torch.hub.load('rwightman\u002Fgen-efficientnet-pytorch', 'efficientnet_b0', pretrained=True)\n>>> model.eval()\n>>> output = model(torch.randn(1,3,224,224))\n```\n\n### Pip\nThis package can be installed via pip.\n\nInstall (after conda env\u002Finstall):\n```\npip install geffnet\n```\n\nEval use:\n```\n>>> import geffnet\n>>> m = geffnet.create_model('mobilenetv3_large_100', pretrained=True)\n>>> m.eval()\n```\n\nTrain use:\n```\n>>> import geffnet\n>>> # models can also be created by using the entrypoint directly\n>>> m = geffnet.efficientnet_b2(pretrained=True, drop_rate=0.25, drop_connect_rate=0.2)\n>>> m.train()\n```\n\nCreate in a nn.Sequential container, for fast.ai, etc:\n```\n>>> import geffnet\n>>> m = geffnet.mixnet_l(pretrained=True, drop_rate=0.25, drop_connect_rate=0.2, as_sequential=True)\n```\n\n### Exporting\n\nScripts are included to\n* export models to ONNX (`onnx_export.py`)\n* optimized ONNX graph (`onnx_optimize.py` or `onnx_validate.py` w\u002F `--onnx-output-opt` arg)\n* validate with ONNX runtime  (`onnx_validate.py`)\n* convert ONNX model to Caffe2 (`onnx_to_caffe.py`)\n* validate in Caffe2 (`caffe2_validate.py`)\n* benchmark in Caffe2 w\u002F FLOPs, parameters output (`caffe2_benchmark.py`)\n\nAs an example, to export the MobileNet-V3 pretrained model and then run an Imagenet validation:\n```\npython onnx_export.py --model mobilenetv3_large_100 .\u002Fmobilenetv3_100.onnx\npython onnx_validate.py \u002Fimagenet\u002Fvalidation\u002F --onnx-input .\u002Fmobilenetv3_100.onnx \n```\n\nThese scripts were tested to be working as of PyTorch 1.6 and ONNX 1.7 w\u002F ONNX runtime 1.4. Caffe2 compatible\nexport now requires additional args mentioned in the export script (not needed in earlier versions).\n\n#### Export Notes\n1. The TF ported weights with the 'SAME' conv padding activated cannot be exported to ONNX unless `_EXPORTABLE` flag in `config.py` is set to True. Use `config.set_exportable(True)` as in the `onnx_export.py` script.\n2. TF ported models with 'SAME' padding will have the padding fixed at export time to the resolution used for export. Even though dynamic padding is supported in opset >= 11, I can't get it working.\n3. ONNX optimize facility doesn't work reliably in PyTorch 1.6 \u002F ONNX 1.7. Fortunately, the onnxruntime based inference is working very well now and includes on the fly optimization.\n3. ONNX \u002F Caffe2 export\u002Fimport frequently breaks with different PyTorch and ONNX version releases. Please check their respective issue trackers before filing issues here.\n\n\n","# （通用）适用于 PyTorch 的 EfficientNets\n\n```diff\n-- **注意** 此仓库已不再维护 --\n```\n请改用 [`timm`](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fpytorch-image-models)。它包含了所有这些模型定义（兼容权重）以及更多功能。\n\n一个“通用”的 EfficientNet、MixNet、MobileNetV3 等实现，涵盖了大多数基于 MobileNet V1\u002FV2 块序列衍生的计算\u002F参数高效架构，包括通过自动化神经架构搜索找到的架构。\n\n所有模型均由 GenEfficientNet 或 MobileNetV3 类实现，并使用基于字符串的架构定义来配置块布局（灵感来自 [这里](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Fblob\u002Fmaster\u002Fmodels\u002Fofficial\u002Fmnasnet\u002Fmnasnet_models.py)）。\n\n## 新增内容\n\n### 2020年8月19日\n* 添加由本人使用 `timm` 训练的更新版 PyTorch EfficientNet-B3 权重（Top-1 准确率 82.1%）\n* 添加由 [@hal-314](https:\u002F\u002Fgithub.com\u002Fhal-314) 贡献的 PyTorch 训练的 EfficientNet-Lite0 权重（Top-1 准确率 75.5%）\n* 更新 ONNX 和 Caffe2 导出\u002F工具脚本，使其与最新版本的 PyTorch \u002F ONNX 兼容\n* 添加了基于 ONNX Runtime 的验证脚本\n* 激活函数（大部分）与 `timm` 的对应实现保持同步\n\n### 2020年4月5日\n* 添加一些使用最新 h-超参数和 RandAugment 训练的新 MobileNet-V2 模型，它们与 EfficientNet-Lite 相比表现相当出色：\n  * 参数量为 350 万的 MobileNet-V2 100，准确率 73%\n  * 参数量为 450 万的 MobileNet-V2 110d，准确率 75%\n  * 参数量为 610 万的 MobileNet-V2 140，准确率 76.5%\n  * 参数量为 580 万的 MobileNet-V2 120d，准确率 77.3%\n\n### 2020年3月23日\n* 添加 EfficientNet-Lite 模型，并移植自 [TensorFlow TPU](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet\u002Flite) 的权重\n* 添加 PyTorch 训练的 MobileNet-V3 Large 权重，Top-1 准确率 75.77%\n* 重要变更（若从头开始训练）：权重初始化方式改为更接近 TensorFlow 实现，旧行为需将 `initialize_weight_goog` 中的 `fix_group_fanout` 设置为 `False`\n\n### 2020年2月12日\n* 添加 EfficientNet-L2 以及 B0-B7 NoisyStudent 权重，移植自 [TensorFlow TPU](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet)\n* 移植新的 EfficientNet-B8（RandAugment）权重，这些权重与 B8 AdvProp 不同，输入归一化方式也不同。\n* 添加 RandAugment 训练的 EfficientNet-ES（EdgeTPU-Small）权重，Top-1 准确率 78.1%。由 [Andrew Lavin](https:\u002F\u002Fgithub.com\u002Fandravin) 训练。\n\n### 2020年1月22日\n* 更新 EfficientNet B0、B2、B3 和 MixNet-XL 的权重，采用最新的 RandAugment 训练权重。由 (https:\u002F\u002Fgithub.com\u002Frwightman\u002Fpytorch-image-models) 训练。\n* 修复 PyTorch 1.4 的 TorchScript 兼容性问题，并为 MixedConv2d 添加 TorchScript 支持，使用 ModuleDict。\n* 使用 PyTorch 1.4 测试模型、TorchScript 和 ONNX 导出，未发现任何问题。\n\n### 2019年11月22日\n* 新的 Top-1 高分！移植官方 TF EfficientNet AdvProp（https:\u002F\u002Farxiv.org\u002Fabs\u002F1911.09665）权重及 B8 模型规格。由于它们使用与原始 EfficientNet base\u002FAA\u002FRA 权重不同的预处理方式（Inception 均值\u002F标准差），因此创建了一套新的 `ap` 模型。\n\n### 2019年11月15日\n* 移植官方 TF MobileNet-V3 float32 large\u002Fsmall\u002Fminimalistic 权重\n* 对 MobileNet-V3 模型及其组件进行修改，以支持 TF MobileNet-V3 与我的实现之间的一些差异所需的额外配置。\n\n### 2019年10月30日\n* 多数模型现在可以与 torch.jit.script 兼容，其中 MixNet 是最大的例外。\n* 改进了启用 TorchScript 或 ONNX 导出兼容模式的接口（通过配置）。\n* 添加了针对 JIT 优化的内存高效的 Swish\u002FMish 自动求导函数，以及内存高效的自动求导函数。\n* 提供激活工厂，可根据名称选择最佳激活函数，或全局覆盖某一激活函数。\n* 添加了预训练检查点加载助手，可处理输入卷积层和分类器的变化。\n\n### 2019年10月27日\n* 添加 CondConv EfficientNet 变体，移植自 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet\u002Fcondconv\n* 添加 TF EfficientNet B5 和 B7 的 RandAug 权重，来源为 https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet\n* 将 MixNet-XL 模型及其深度缩放算法从我的 pytorch-image-models 代码库中引入。\n* 将激活函数和全局池化层改为模块形式。\n* 添加内存高效的 Swish\u002FMish 实现。\n* 为所有模型添加 as_sequential() 方法，并允许在入口函数中作为参数使用。\n* 将 MobileNetV3 单独移至一个文件，因为它具有不同的头部结构。\n* 删除 ChamNet、MobileNet V2\u002FV1，因为它们可能永远不会在此处使用。\n\n## 模型列表\n\n已实现的模型包括：\n  * EfficientNet NoisyStudent（B0-B7, L2）（https:\u002F\u002Farxiv.org\u002Fabs\u002F1911.04252）\n  * EfficientNet AdvProp（B0-B8）（https:\u002F\u002Farxiv.org\u002Fabs\u002F1911.09665）\n  * EfficientNet（B0-B8）（https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.11946）\n  * EfficientNet-EdgeTPU（S、M、L）（https:\u002F\u002Fai.googleblog.com\u002F2019\u002F08\u002Fefficientnet-edgetpu-creating.html）\n  * EfficientNet-CondConv（https:\u002F\u002Farxiv.org\u002Fabs\u002F1904.04971）\n  * EfficientNet-Lite（https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet\u002Flite）\n  * MixNet（https:\u002F\u002Farxiv.org\u002Fabs\u002F1907.09595）\n  * MNASNet B1、A1（Squeeze-Excite）以及 Small（https:\u002F\u002Farxiv.org\u002Fabs\u002F1807.11626）\n  * MobileNet-V3（https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.02244）\n  * FBNet-C（https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.03443）\n  * Single-Path NAS（https:\u002F\u002Farxiv.org\u002Fabs\u002F1904.02877）\n\n我最初使用 [此处](https:\u002F\u002Fgithub.com\u002Frwightman\u002Fpytorch-image-models) 的代码实现了并训练了部分模型，而此仓库仅包含 GenEfficientNet 模型、验证代码以及相关的 ONNX\u002FCaffe2 导出代码。\n\n## 预训练模型\n\n我已经成功训练了多个模型，其准确率接近或超过了原始论文及官方实现的水平。我的训练代码已开源，地址为：https:\u002F\u002Fgithub.com\u002Frwightman\u002Fpytorch-image-models\n\n\n|模型 | 精确度@1 (错误率) | 精确度@5 (错误率) | 参数量(M) | 浮点运算量(M) | 图像缩放 | 分辨率 | 裁剪比例 |\n|---|---|---|---|---|---|---|---|\n| efficientnet_b3 | 82.240 (17.760) | 96.116 (3.884) | 12.23 | 待定 | 双三次插值 | 320 | 1.0 |\n| efficientnet_b3 | 82.076 (17.924) | 96.020 (3.980) | 12.23 | 待定 | 双三次插值 | 300 | 0.904 |\n| mixnet_xl | 81.074 (18.926) | 95.282 (4.718) | 11.90 | 待定 | 双三次插值 | 256 | 1.0 |\n| efficientnet_b2 | 80.612 (19.388) | 95.318 (4.682) | 9.1 | 待定 | 双三次插值 | 288 | 1.0 |\n| mixnet_xl | 80.476 (19.524) | 94.936 (5.064) | 11.90 | 待定 | 双三次插值 | 224 | 0.875 |\n| efficientnet_b2 | 80.288 (19.712) | 95.166 (4.834) | 9.1 | 1003 | 双三次插值 | 260 | 0.890 |\n| mixnet_l | 78.976 (21.024) | 94.184 (5.816) | 7.33 | 待定 | 双三次插值 | 224 | 0.875 |\n| efficientnet_b1 | 78.692 (21.308) | 94.086 (5.914) | 7.8 | 694 | 双三次插值 | 240 | 0.882 |\n| efficientnet_es | 78.066 (21.934) | 93.926 (6.074) | 5.44 | 待定 | 双三次插值 | 224 | 0.875 |\n| efficientnet_b0 | 77.698 (22.302) | 93.532 (6.468) | 5.3 | 390 | 双三次插值 | 224 | 0.875 |\n| mobilenetv2_120d | 77.294 (22.706) | 93.502 (6.498) | 5.8 | 待定 | 双三次插值 | 224 | 0.875 |\n| mixnet_m | 77.256 (22.744) | 93.418 (6.582) | 5.01 | 353 | 双三次插值 | 224 | 0.875 |\n| mobilenetv2_140 | 76.524 (23.476) | 92.990 (7.010) | 6.1 | 待定 | 双三次插值 | 224 | 0.875 |\n| mixnet_s | 75.988 (24.012) | 92.794 (7.206) | 4.13 | 待定 | 双三次插值 | 224 | 0.875 |\n| mobilenetv3_large_100 | 75.766 (24.234) | 92.542 (7.458) | 5.5 | 待定 | 双三次插值 | 224 | 0.875 |\n| mobilenetv3_rw | 75.634 (24.366) | 92.708 (7.292) | 5.5 | 219 | 双三次插值 | 224 | 0.875 |\n| efficientnet_lite0 | 75.472 (24.528) | 92.520 (7.480) | 4.65 | 待定 | 双三次插值 | 224 | 0.875 |\n| mnasnet_a1 | 75.448 (24.552) | 92.604 (7.396) | 3.9 | 312 | 双三次插值 | 224 | 0.875 |\n| fbnetc_100 | 75.124 (24.876) | 92.386 (7.614) | 5.6 | 385 | 双线性插值 | 224 | 0.875 |\n| mobilenetv2_110d | 75.052 (24.948) | 92.180 (7.820) | 4.5 | 待定 | 双三次插值 | 224 | 0.875 |\n| mnasnet_b1 | 74.658 (25.342) | 92.114 (7.886) | 4.4 | 315 | 双三次插值 | 224 | 0.875 |\n| spnasnet_100 | 74.084 (25.916) | 91.818 (8.182) | 4.4 | 待定 | 双线性插值 | 224 | 0.875 |\n| mobilenetv2_100 | 72.978 (27.022) | 91.016 (8.984) | 3.5 | 待定 | 双三次插值 | 224 | 0.875 |\n\n\n更多预训练模型即将推出...\n\n\n## 移植权重\n\n从 TensorFlow 检查点移植而来的 EfficientNet 模型权重，在添加与 SAME 卷积填充等效的方式，并使用相同的裁剪因子、图像缩放等参数（见表格）后，其准确率几乎可以与 TensorFlow 实现持平。\n\n**重要提示：**\n* EfficientNet AdvProp (AP)、EfficientNet EdgeTPU、EfficientNet-CondConv、EfficientNet-Lite 和 MobileNet-V3 模型的 TensorFlow 移植权重使用 Inception 风格的均值和标准差（0.5, 0.5, 0.5）。\n* 在验证时启用 TensorFlow 预处理管道（通过 `--tf-preprocessing` 参数），可将分数提升 0.1% 至 0.5%，非常接近原始 TensorFlow 实现的结果。\n\n运行 tf_efficientnet_b5 的验证命令：\n`python validate.py \u002Fpath\u002Fto\u002Fimagenet\u002Fvalidation\u002F --model tf_efficientnet_b5 -b 64 --img-size 456 --crop-pct 0.934 --interpolation bicubic`\n\n运行带有 TensorFlow 预处理的 tf_efficientnet_b5 验证命令：\n`python validate.py \u002Fpath\u002Fto\u002Fimagenet\u002Fvalidation\u002F --model tf_efficientnet_b5 -b 64 --img-size 456 --tf-preprocessing`\n\n运行采用 Inception 预处理的模型验证命令，例如 EfficientNet-B8 AdvProp：\n`python validate.py \u002Fpath\u002Fto\u002Fimagenet\u002Fvalidation\u002F --model tf_efficientnet_b8_ap -b 48 --num-gpu 2 --img-size 672 --crop-pct 0.954 --mean 0.5 --std 0.5`\n\n|模型 | 精确度@1 (误差) | 精确度@5 (误差) | 参数量 | 图像缩放 | 图像尺寸 | 裁剪 |\n|---|---|---|---|---|---|---|\n| tf_efficientnet_l2_ns *tfp | 88.352 (11.648) | 98.652 (1.348) | 480 | 双三次插值 | 800 | 不适用 |\n| tf_efficientnet_l2_ns      | 待定 | 待定 | 480 | 双三次插值 | 800 | 0.961 |\n| tf_efficientnet_l2_ns_475      | 88.234 (11.766) | 98.546 (1.454) | 480 | 双三次插值 | 475 | 0.936 |\n| tf_efficientnet_l2_ns_475 *tfp | 88.172 (11.828) | 98.566 (1.434) | 480 | 双三次插值 | 475 | 不适用 |\n| tf_efficientnet_b7_ns *tfp | 86.844 (13.156) | 98.084 (1.916) | 66.35 | 双三次插值 | 600 | 不适用 |\n| tf_efficientnet_b7_ns      | 86.840 (13.160) | 98.094 (1.906) | 66.35 | 双三次插值 | 600 | 不适用 |\n| tf_efficientnet_b6_ns      | 86.452 (13.548) | 97.882 (2.118) | 43.04 | 双三次插值 | 528 | 不适用 |\n| tf_efficientnet_b6_ns *tfp | 86.444 (13.556) | 97.880 (2.120) | 43.04 | 双三次插值 | 528 | 不适用 |\n| tf_efficientnet_b5_ns *tfp | 86.064 (13.936) | 97.746 (2.254) | 30.39 | 双三次插值 | 456 | 不适用 |\n| tf_efficientnet_b5_ns      | 86.088 (13.912) | 97.752 (2.248) | 30.39 | 双三次插值 | 456 | 不适用 |\n| tf_efficientnet_b8_ap *tfp | 85.436 (14.564) | 97.272 (2.728) | 87.4 | 双三次插值 | 672 | 不适用 |\n| tf_efficientnet_b8 *tfp    | 85.384 (14.616) | 97.394 (2.606) | 87.4 | 双三次插值 | 672 | 不适用 |\n| tf_efficientnet_b8         | 85.370 (14.630) | 97.390 (2.610) | 87.4 | 双三次插值 | 672 | 0.954 |\n| tf_efficientnet_b8_ap      | 85.368 (14.632) | 97.294 (2.706) | 87.4 | 双三次插值 | 672 | 0.954 |\n| tf_efficientnet_b4_ns *tfp | 85.298 (14.702) | 97.504 (2.496) | 19.34 | 双三次插值 | 380 | 不适用 |\n| tf_efficientnet_b4_ns      | 85.162 (14.838) | 97.470 (2.530) | 19.34 | 双三次插值 | 380 | 0.922 |\n| tf_efficientnet_b7_ap *tfp | 85.154 (14.846) | 97.244 (2.756) | 66.35 | 双三次插值 | 600 | 不适用 |\n| tf_efficientnet_b7_ap      | 85.118 (14.882) | 97.252 (2.748) | 66.35 | 双三次插值 | 600 | 0.949 |\n| tf_efficientnet_b7 *tfp | 84.940 (15.060) | 97.214 (2.786) | 66.35 | 双三次插值 | 600 | 不适用 |\n| tf_efficientnet_b7      | 84.932 (15.068) | 97.208 (2.792) | 66.35 | 双三次插值 | 600 | 0.949 |\n| tf_efficientnet_b6_ap      | 84.786 (15.214) | 97.138 (2.862) | 43.04 | 双三次插值 | 528 | 0.942 |\n| tf_efficientnet_b6_ap *tfp | 84.760 (15.240) | 97.124 (2.876) | 43.04 | 双三次插值 | 528 | 不适用 |\n| tf_efficientnet_b5_ap *tfp | 84.276 (15.724) | 96.932 (3.068) | 30.39 | 双三次插值 | 456 | 不适用 |\n| tf_efficientnet_b5_ap      | 84.254 (15.746) | 96.976 (3.024) | 30.39 | 双三次插值 | 456 | 0.934 |\n| tf_efficientnet_b6 *tfp  | 84.140 (15.860) | 96.852 (3.148) | 43.04 | 双三次插值 | 528 | 不适用 |\n| tf_efficientnet_b6       | 84.110 (15.890) | 96.886 (3.114) | 43.04 | 双三次插值 | 528 | 0.942 |\n| tf_efficientnet_b3_ns *tfp | 84.054 (15.946) | 96.918 (3.082) | 12.23 | 双三次插值 | 300 | 不适用 |\n| tf_efficientnet_b3_ns      | 84.048 (15.952) | 96.910 (3.090) | 12.23 | 双三次插值 | 300 | 0.904 |\n| tf_efficientnet_b5 *tfp  | 83.822 (16.178) | 96.756 (3.244) | 30.39 | 双三次插值 | 456 | 不适用 |\n| tf_efficientnet_b5       | 83.812 (16.188) | 96.748 (3.252) | 30.39 | 双三次插值 | 456 | 0.934 |\n| tf_efficientnet_b4_ap *tfp | 83.278 (16.722) | 96.376 (3.624) | 19.34 | 双三次插值 | 380 | 不适用 |\n| tf_efficientnet_b4_ap      | 83.248 (16.752) | 96.388 (3.612) | 19.34 | 双三次插值 | 380 | 0.922 |\n| tf_efficientnet_b4       | 83.022 (16.978) | 96.300 (3.700) | 19.34 | 双三次插值 | 380 | 0.922 |\n| tf_efficientnet_b4 *tfp  | 82.948 (17.052) | 96.308 (3.692) | 19.34 | 双三次插值 | 380 | 不适用 |\n| tf_efficientnet_b2_ns *tfp | 82.436 (17.564) | 96.268 (3.732) | 9.11 | 双三次插值 | 260 | 不适用 |\n| tf_efficientnet_b2_ns      | 82.380 (17.620) | 96.248 (3.752) | 9.11 | 双三次插值 | 260 | 0.89 |\n| tf_efficientnet_b3_ap *tfp | 81.882 (18.118) | 95.662 (4.338) | 12.23 | 双三次插值 | 300 | 不适用 |\n| tf_efficientnet_b3_ap      | 81.828 (18.172) | 95.624 (4.376) | 12.23 | 双三次插值 | 300 | 0.904 |\n| tf_efficientnet_b3       | 81.636 (18.364) | 95.718 (4.282) | 12.23 | 双三次插值 | 300 | 0.904 |\n| tf_efficientnet_b3 *tfp  | 81.576 (18.424) | 95.662 (4.338) | 12.23 | 双三次插值 | 300 | 不适用 |\n| tf_efficientnet_lite4      | 81.528 (18.472) | 95.668 (4.332) | 13.00  | 双线性插值 | 380 | 0.92 |\n| tf_efficientnet_b1_ns *tfp | 81.514 (18.486) | 95.776 (4.224) | 7.79 | 双三次插值 | 240 | 不适用 |\n| tf_efficientnet_lite4 *tfp | 81.502 (18.498) | 95.676 (4.324) | 13.00  | 双线性插值 | 380 | 不适用 |\n| tf_efficientnet_b1_ns      | 81.388 (18.612) | 95.738 (4.262) | 7.79 | 双三次插值 | 240 | 0.88 |\n| tf_efficientnet_el       | 80.534 (19.466) | 95.190 (4.810) | 10.59 | 双三次插值 | 300 | 0.904 |\n| tf_efficientnet_el *tfp  | 80.476 (19.524) | 95.200 (4.800) | 10.59 | 双三次插值 | 300 | 不适用 |\n| tf_efficientnet_b2_ap *tfp | 80.420 (19.580) | 95.040 (4.960) | 9.11 | 双三次插值 | 260 | 不适用 |\n| tf_efficientnet_b2_ap    | 80.306 (19.694) | 95.028 (4.972) | 9.11 | 双三次插值 | 260 | 0.890 |\n| tf_efficientnet_b2 *tfp  | 80.188 (19.812) | 94.974 (5.026) | 9.11 | 双三次插值 | 260 | 不适用 |\n| tf_efficientnet_b2       | 80.086 (19.914) | 94.908 (5.092) | 9.11 | 双三次插值 | 260 | 0.890 |\n| tf_efficientnet_lite3       | 79.812 (20.188) | 94.914 (5.086) | 8.20  | 双线性插值 | 300 | 0.904 |\n| tf_efficientnet_lite3 *tfp  | 79.734 (20.266) | 94.838 (5.162) | 8.20  | 双线性插值 | 300 | 不适用 |\n| tf_efficientnet_b1_ap *tfp | 79.532 (20.468) | 94.378 (5.622) | 7.79 | 双三次插值 | 240 | 不适用 |\n| tf_efficientnet_cc_b1_8e *tfp | 79.464 (20.536) | 94.492 (5.508) | 39.7 | 双三次插值 | 240 | 0.88 |\n| tf_efficientnet_cc_b1_8e | 79.298 (20.702) | 94.364 (5.636) | 39.7 | 双三次插值 | 240 | 0.88 |\n| tf_efficientnet_b1_ap    | 79.278 (20.722) | 94.308 (5.692) | 7.79 | 双三次插值 | 240 | 0.88 |\n| tf_efficientnet_b1 *tfp  | 79.172 (20.828) | 94.450 (5.550) | 7.79 | 双三次插值 | 240 | 不适用 |\n| tf_efficientnet_em *tfp  | 78.958 (21.042) | 94.458 (5.542) | 6.90 | 双三次插值 | 240 | 不适用 |\n| tf_efficientnet_b0_ns *tfp | 78.806 (21.194) | 94.496 (5.504) | 5.29 | 双三次插值 | 224 | 不适用 |\n| tf_mixnet_l *tfp         | 78.846 (21.154) | 94.212 (5.788) | 7.33 | 双线性插值 | 224 | 不适用 |\n| tf_efficientnet_b1       | 78.826 (21.174) | 94.198 (5.802) | 7.79 | 双三次插值 | 240 | 0.88 |\n| tf_mixnet_l              | 78.770 (21.230) | 94.004 (5.996) | 7.33 | 双三次插值 | 224 | 0.875 |\n| tf_efficientnet_em       | 78.742 (21.258) | 94.332 (5.668) | 6.90 | 双三次插值 | 240 | 0.875 |\n| tf_efficientnet_b0_ns    | 78.658 (21.342) | 94.376 (5.624) | 5.29 | 双三次插值 | 224 | 0.875 |\n| tf_efficientnet_cc_b0_8e *tfp | 78.314 (21.686) | 93.790 (6.210) | 24.0 | 双三次插值 | 224 | 0.875 |\n| tf_efficientnet_cc_b0_8e | 77.908 (22.092) | 93.656 (6.344) | 24.0 | 双三次插值 | 224 | 0.875 |\n| tf_efficientnet_cc_b0_4e *tfp | 77.746 (22.254) | 93.552 (6.448) | 13.3 | 双三次插值 | 224 | 0.875 |\n| tf_efficientnet_cc_b0_4e | 77.304 (22.696) | 93.332 (6.668) | 13.3 | 双三次插值 | 224 | 0.875 |\n| tf_efficientnet_es *tfp  | 77.616 (22.384) | 93.750 (6.250) | 5.44 | 双三次插值 | 240 | 不适用 |\n| tf_efficientnet_lite2 *tfp  | 77.544 (22.456) | 93.800 (6.200) | 6.09  | 双线性插值 | 260 | 不适用 |\n| tf_efficientnet_lite2       | 77.460 (22.540) | 93.746 (6.254) | 6.09  | 双三次插值 | 260 | 0.89 |\n| tf_efficientnet_b0_ap *tfp | 77.514 (22.486) | 93.576 (6.424) | 5.29  | 双三次插值 | 240 | 不适用 |\n| tf_efficientnet_es       | 77.264 (22.736) | 93.600 (6.400) | 5.44 | 双三次插值 | 240 | 不适用 |\n| tf_efficientnet_b0 *tfp  | 77.258 (22.742) | 93.478 (6.522) | 5.29  | 双三次插值 | 240 | 不适用 |\n| tf_efficientnet_b0_ap    | 77.084 (22.916) | 93.254 (6.746) | 5.29  | 双三次插值 | 240 | 0.875 |\n| tf_mixnet_m *tfp         | 77.072 (22.928) | 93.368 (6.632) | 5.01 | 双线性插值 | 224 | 不适用 |\n| tf_mixnet_m              | 76.950 (23.050) | 93.156 (6.844) | 5.01 | 双三次插值 | 224 | 0.875 |\n| tf_efficientnet_b0       | 76.848 (23.152) | 93.228 (6.772) | 5.29  | 双三次插值 | 224 | 0.875 |\n| tf_efficientnet_lite1 *tfp  | 76.764 (23.236) | 93.326 (6.674) | 5.42  | 双线性插值 | 240 | 不适用 |\n| tf_efficientnet_lite1       | 76.638 (23.362) | 93.232 (6.76) | 5.42  | 双三次插值 | 240 | 0.882 |\n| tf_mixnet_s *tfp         | 75.800 (24.200) | 92.788 (7.212) | 4.13 | 双线性插值 | 224 | 不适用 |\n| tf_mobilenetv3_large_100 *tfp | 75.768 (24.232) | 92.710 (7.290) | 5.48 | 双线性插值 | 240 | 不适用 |\n| tf_mixnet_s              | 75.648 (24.352) | 92.636 (7.364) | 4.13 | 双三次插值 | 224 | 0.875 |\n| tf_mobilenetv3_large_100 | 75.516 (24.484) | 92.600 (7.400) | 5.48 | 双线性插值 | 240 | 0.875 |\n| tf_efficientnet_lite0 *tfp  | 75.074 (24.926) | 92.314 (7.686) | 4.65  | 双线性插值 | 240 | 不适用 |\n| tf_efficientnet_lite0       | 74.842 (25.158) | 92.170 (7.830) | 4.65  | 双三次插值 | 240 | 0.875 |\n| tf_mobilenetv3_large_075 *tfp | 73.730 (26.270) | 91.616 (8.384) | 3.99 | 双线性插值 | 240 | 不适用 |\n| tf_mobilenetv3_large_075 | 73.442 (26.558) | 91.352 (8.648) | 3.99 | 双线性插值 | 240 | 0.875 |\n| tf_mobilenetv3_large_minimal_100 *tfp | 72.678 (27.322) | 90.860 (9.140) | 3.92 | 双线性插值 | 240 | 不适用 |\n| tf_mobilenetv3_large_minimal_100 | 72.244 (27.756) | 90.636 (9.364) | 3.92 | 双线性插值 | 240 | 0.875 |\n| tf_mobilenetv3_small_100 *tfp | 67.918 (32.082) | 87.958 (12.042 | 2.54 | 双线性插值 | 240 | 不适用 |\n| tf_mobilenetv3_small_100 | 67.918 (32.082) | 87.662 (12.338) | 2.54 | 双线性插值 | 240 | 0.875 |\n| tf_mobilenetv3_small_075 *tfp | 66.142 (33.858) | 86.498 (13.502) | 2.04 | 双线性插值 | 240 | 不适用 |\n| tf_mobilenetv3_small_075 | 65.718 (34.282) | 86.136 (13.864) | 2.04 | 双线性插值 | 240 | 0.875 |\n| tf_mobilenetv3_small_minimal_100 *tfp | 63.378 (36.622) | 84.802 (15.198) | 2.04 | 双线性插值 | 240 | 不适用 |\n| tf_mobilenetv3_small_minimal_100 | 62.898 (37.102) | 84.230 (15.770) | 2.04 | 双线性插值 | 240 | 0.875 |\n\n*使用 `tf-preprocessing` 管道验证的 TFP 模型\n\n从官方 TensorFlow 仓库移植而来的 Google TF 和 TFLite 权重\n* https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fmnasnet\n* https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet\n* https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fmodels\u002Ftree\u002Fmaster\u002Fresearch\u002Fslim\u002Fnets\u002Fmobilenet\n\n\n\n## 使用方法\n\n### 环境\n\n所有开发和测试均在 Linux x86-64 系统上的 Conda Python 3 环境中完成，具体为 Python 3.6.x、3.7.x 和 3.8.x。\n\n有用户反馈称，在 Windows 系统上使用 Python 3 的 Anaconda 安装也能正常工作。但我本人尚未对此进行验证。\n\n已使用 PyTorch 1.4、1.5 和 1.6 版本对该代码进行了测试。\n\n我尽量保持依赖项最少，安装步骤遵循 PyTorch 在 Conda 上的默认安装说明：\n```\nconda create -n torch-env\nconda activate torch-env\nconda install -c pytorch pytorch torchvision cudatoolkit=10.2\n```\n\n### PyTorch Hub\n\n可通过 PyTorch Hub API 访问模型：\n\n```\n>>> torch.hub.list('rwightman\u002Fgen-efficientnet-pytorch')\n['efficientnet_b0', ...]\n>>> model = torch.hub.load('rwightman\u002Fgen-efficientnet-pytorch', 'efficientnet_b0', pretrained=True)\n>>> model.eval()\n>>> output = model(torch.randn(1,3,224,224))\n```\n\n### pip\n此包可通过 pip 安装。\n\n安装（在创建并激活 Conda 环境后）：\n```\npip install geffnet\n```\n\n评估用法：\n```\n>>> import geffnet\n>>> m = geffnet.create_model('mobilenetv3_large_100', pretrained=True)\n>>> m.eval()\n```\n\n训练用法：\n```\n>>> import geffnet\n>>> # 也可以直接通过入口点创建模型\n>>> m = geffnet.efficientnet_b2(pretrained=True, drop_rate=0.25, drop_connect_rate=0.2)\n>>> m.train()\n```\n\n用于 fast.ai 等框架的 nn.Sequential 容器：\n```\n>>> import geffnet\n>>> m = geffnet.mixnet_l(pretrained=True, drop_rate=0.25, drop_connect_rate=0.2, as_sequential=True)\n```\n\n### 导出\n\n包含以下脚本：\n* 将模型导出为 ONNX 格式（`onnx_export.py`）\n* 优化 ONNX 图（`onnx_optimize.py` 或带有 `--onnx-output-opt` 参数的 `onnx_validate.py`）\n* 使用 ONNX Runtime 进行验证（`onnx_validate.py`）\n* 将 ONNX 模型转换为 Caffe2 格式（`onnx_to_caffe.py`）\n* 在 Caffe2 中进行验证（`caffe2_validate.py`）\n* 在 Caffe2 中进行基准测试，输出 FLOPs 和参数量（`caffe2_benchmark.py`）\n\n例如，导出 MobileNet-V3 预训练模型并运行 ImageNet 验证：\n```\npython onnx_export.py --model mobilenetv3_large_100 .\u002Fmobilenetv3_100.onnx\npython onnx_validate.py \u002Fimagenet\u002Fvalidation\u002F --onnx-input .\u002Fmobilenetv3_100.onnx \n```\n\n这些脚本已在 PyTorch 1.6 和 ONNX 1.7 以及 ONNX Runtime 1.4 下测试通过。现在，要实现与 Caffe2 兼容的导出，需要使用导出脚本中提到的额外参数（在早期版本中不需要）。\n\n#### 导出注意事项\n1. 如果启用了 ‘SAME’ 卷积填充的 TF 移植权重，则无法导出为 ONNX 格式，除非将 `config.py` 中的 `_EXPORTABLE` 标志设置为 True。请按照 `onnx_export.py` 脚本中的做法使用 `config.set_exportable(True)`。\n2. 带有 ‘SAME’ 填充的 TF 移植模型在导出时会将填充固定为导出时使用的分辨率。尽管 opset >= 11 支持动态填充，但我目前仍无法使其正常工作。\n3. 在 PyTorch 1.6 和 ONNX 1.7 下，ONNX 优化功能并不稳定可靠。幸运的是，基于 ONNX Runtime 的推理目前运行良好，并且支持实时优化。\n4. ONNX 和 Caffe2 的导出\u002F导入功能经常因 PyTorch 和 ONNX 版本更新而出现问题。请在向本项目提交问题之前，先查看它们各自的 issue 追踪页面。","# gen-efficientnet-pytorch 快速上手指南\n\n> **⚠️ 重要提示**：本仓库（gen-efficientnet-pytorch）已**停止维护**。作者强烈建议开发者转而使用 [`timm`](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fpytorch-image-models) 库。`timm` 包含了本仓库所有的模型定义和兼容权重，并提供了更多新模型及功能。以下内容仅作为历史参考或特定旧版本需求使用。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**: Linux, macOS 或 Windows\n*   **Python**: 3.6 或更高版本\n*   **PyTorch**: 1.4 或更高版本（推荐最新稳定版）\n*   **其他依赖**: `torchvision`, `onnx` (可选，用于导出), `caffe2` (可选)\n\n## 安装步骤\n\n由于原仓库已不再活跃更新，建议直接通过 `pip` 安装其最终发布版本，或者克隆代码本地安装。\n\n### 方式一：通过 Pip 安装（推荐）\n\n```bash\npip install geffnet\n```\n\n### 方式二：从源码安装\n\n如果您需要修改代码或使用特定分支：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Frwightman\u002Fgen-efficientnet-pytorch.git\ncd gen-efficientnet-pytorch\npip install -e .\n```\n\n> **国内加速提示**：如果下载速度较慢，建议使用国内镜像源安装：\n> ```bash\n> pip install geffnet -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n> ```\n\n## 基本使用\n\n本库提供了统一的接口来加载各种高效网络模型（如 EfficientNet, MobileNetV3, MixNet 等）。\n\n### 1. 加载预训练模型\n\n使用 `create_model` 函数即可轻松加载模型。以下以加载 `efficientnet_b0` 为例：\n\n```python\nimport torch\nfrom geffnet import create_model\n\n# 创建模型并加载预训练权重\nmodel = create_model('efficientnet_b0', pretrained=True)\n\n# 将模型设置为评估模式\nmodel.eval()\n\n# 移动到 GPU (如果可用)\nif torch.cuda.is_available():\n    model = model.cuda()\n```\n\n### 2. 执行推理\n\n准备一个输入张量（例如批量大小为 1，3 通道，224x224 分辨率的图像），并进行前向传播：\n\n```python\n# 创建一个随机输入张量模拟图像数据 (Batch, Channels, Height, Width)\ninput_tensor = torch.randn(1, 3, 224, 224)\n\nif torch.cuda.is_available():\n    input_tensor = input_tensor.cuda()\n\n# 执行推理\nwith torch.no_grad():\n    output = model(input_tensor)\n\n# 获取预测类别概率\nprobabilities = torch.softmax(output, dim=1)\nprint(f\"输出形状：{output.shape}\")\n```\n\n### 3. 加载不同变体\n\n库中支持多种架构，只需更改模型名称字符串即可：\n\n```python\n# 加载 MobileNetV3 Large\nmodel_mv3 = create_model('mobilenetv3_large_100', pretrained=True)\n\n# 加载 MixNet Small\nmodel_mix = create_model('mixnet_s', pretrained=True)\n\n# 加载带 AdvProp 权重的 EfficientNet B8 (注意：此类模型通常需要使用 Inception 风格的归一化参数)\nmodel_b8_ap = create_model('tf_efficientnet_b8_ap', pretrained=True)\n```\n\n### 4. 关于预处理的重要说明\n\n*   **标准模型**：大多数 PyTorch 原生训练的模型使用标准的 ImageNet 均值和标准差进行归一化。\n*   **TensorFlow 移植模型**：名称中以 `tf_` 开头的模型（如 `tf_efficientnet_b5`）是从 TensorFlow 检查点移植的。\n    *   部分模型（如 AdvProp, EdgeTPU, Lite 系列）使用 **Inception 风格** 的归一化参数 (`mean=[0.5, 0.5, 0.5]`, `std=[0.5, 0.5, 0.5]`)。\n    *   在验证或推理时，若使用 `--tf-preprocessing` 参数（在提供的验证脚本中）或手动应用对应的归一化变换，可获得更准确的复现结果。","某边缘计算团队正致力于将高精度图像分类模型部署到算力受限的工业质检摄像头中，需要在极低的延迟下识别微小缺陷。\n\n### 没有 gen-efficientnet-pytorch 时\n- **模型选型困难**：团队需在 EfficientNet、MobileNetV3、MixNet 等多种高效架构间反复切换代码库，缺乏统一接口导致实验流程割裂。\n- **复现成本高昂**：手动复现论文中的神经架构搜索（NAS）结果极易出错，且难以直接获取与 TensorFlow 官方权重精度对齐的 PyTorch 版本。\n- **部署适配繁琐**：模型导出为 ONNX 或 Caffe2 格式时常因算子不兼容报错，需花费大量时间修改底层激活函数（如 Swish\u002FMish）以适配推理引擎。\n- **性能调优盲目**：缺乏预训练的高质量轻量级权重（如 EfficientNet-Lite），只能从零训练，导致在有限数据集上收敛慢且最终精度不达标。\n\n### 使用 gen-efficientnet-pytorch 后\n- **架构切换自如**：通过统一的字符串配置即可瞬间切换 EfficientNet-B3、MobileNet-V2 或 Single-Path NAS 等十几种架构，大幅加速了针对特定硬件的模型筛选。\n- **精度无缝迁移**：直接加载已端口好的 TensorFlow TPU 官方权重（包括 AdvProp 和 NoisyStudent 版本），确保 PyTorch 环境下的 Top-1 准确率与官方报告完全一致。\n- **部署一键导出**：利用内置优化的 TorchScript 和 ONNX 导出脚本，轻松解决混合卷积（MixedConv2d）等特殊算子的兼容性问题，快速生成端侧推理模型。\n- **启动即达最优**：直接使用针对边缘设备优化的 EfficientNet-Lite 和 RandAugment 训练权重，在少量质检图片上微调即可迅速达到 75%+ 的高精度，缩短研发周期。\n\ngen-efficientnet-pytorch 通过提供统一且高精度的高效模型实现，消除了从算法验证到端侧部署之间的技术摩擦，让团队能专注于业务逻辑而非底层架构修补。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Frwightman_gen-efficientnet-pytorch_b2d8f878.png","rwightman","Ross Wightman","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Frwightman_2b42e5de.jpg","AI, Computer Vision. Always learning, constantly curious. Building ML\u002FAI systems, watching loss curves.",null,"Vancouver, BC, Canada","wightmanr","rwightman.com","https:\u002F\u002Fgithub.com\u002Frwightman",[83],{"name":84,"color":85,"percentage":86},"Python","#3572A5",100,1584,216,"2026-04-03T16:17:28","Apache-2.0",1,"未说明","未说明（支持 CPU 运行，但验证脚本示例中包含 --num-gpu 参数，表明支持多 GPU 加速）",{"notes":95,"python":96,"dependencies":97},"该仓库已不再维护，作者强烈建议改用 'timm' (pytorch-image-models) 库，后者包含所有模型定义及更多功能。部分从 TensorFlow 移植的权重（如 EfficientNet AdvProp, EdgeTPU, Lite 等）需要使用 Inception 风格的均值和标准差 (0.5, 0.5, 0.5) 进行预处理。验证时可通过 --tf-preprocessing 参数启用 TensorFlow 预处理流程以提升精度。","未说明（文中提及测试兼容 PyTorch 1.4，暗示支持 Python 3.6+）",[98,99,100],"torch","onnx","caffe2",[14],[103,104,105,106,107,99,100,108],"mobilenetv3","mnasnet","fbnet","pytorch","pretrained-models","efficientnet","2026-03-27T02:49:30.150509","2026-04-07T09:49:50.070449",[112,117,122,127,132,137],{"id":113,"question_zh":114,"answer_zh":115,"source_url":116},21434,"如何将训练好的 PyTorch EfficientNet-Lite 权重转换回 TensorFlow 或 TFLite？","转换时需注意以下几点以确保兼容性和性能：\n1. 禁用训练模式：PyTorch 中调用 `model.eval()`，TensorFlow 中设置 `training=False`。\n2. 覆盖参数配置：在 TensorFlow 中需显式设置批归一化参数，例如：\n   ```python\n   override_params = {}\n   override_params['batch_norm_momentum'] = 0.99\n   override_params['batch_norm_epsilon'] = 1e-3\n   override_params['batch_norm'] = tf.layers.BatchNormalization\n   ```\n3. 获取变量集合：使用 `trainable_collection = tf.get_collection_ref(tf.GraphKeys.GLOBAL_VARIABLES)`。\n4. 解决 TFLite 转换问题：若遇到 `tf.FusedBatchNormV3` 相关错误，需在转换器中指定支持的操作集：\n   ```python\n   converter.target_spec.supported_ops = [\n       tf.lite.OpsSet.TFLITE_BUILTINS,\n       tf.lite.OpsSet.SELECT_TF_OPS\n   ]\n   ```\n直接通过 ONNX 转换可能会导致模型变慢（如出现多余的 transpose 层），建议参考上述步骤手动调整。","https:\u002F\u002Fgithub.com\u002Frwightman\u002Fgen-efficientnet-pytorch\u002Fissues\u002F50",{"id":118,"question_zh":119,"answer_zh":120,"source_url":121},21435,"为什么加载 efficientnet_b4 到 b7 的预训练模型时报错 URL 为空？","这是因为不带前缀的模型（如 `efficientnet_b5`）是由作者自行在 PyTorch 中训练的，目前只提供了较小模型（b0-b3）的权重。较大的模型（b4-b7）通常需要使用从 TensorFlow 官方权重转换过来的版本。\n解决方法是使用带有 `tf_` 前缀的模型名称，例如：\n```python\nmodel = geffnet.create_model('tf_efficientnet_b5', pretrained=True)\n```\n这些权重源自 Google 的 TensorFlow TPU 仓库，已被移植到 PyTorch。带 `tf_` 前缀的模型通常在精度上表现更好，因为它们使用了原始的 TensorFlow 权重和 SAME 填充策略。","https:\u002F\u002Fgithub.com\u002Frwightman\u002Fgen-efficientnet-pytorch\u002Fissues\u002F53",{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},21436,"如何将该模型用作特征提取器（去掉分类头）？","有两种主要方法可以提取特征：\n1. 使用 `.as_sequential()` 方法：创建模型后调用此方法可移除分类头，使其变为纯卷积网络。\n   ```python\n   m = timm.create_model('efficientnet_b2a', pretrained=True).as_sequential()\n   ```\n   注意：`create_model` 函数本身可能不支持 `as_sequential` 作为初始化参数，需在实例化后调用该方法。\n2. 使用 `forward_features` 方法：对于 `timm` 库中的所有模型，可以直接调用 `model.forward_features(input)` 来获取未池化的特征输出。\n未来版本可能支持通过设置 `num_classes=0` 或调用 `.reset(0)` 来直接获得带池化的特征输出。","https:\u002F\u002Fgithub.com\u002Frwightman\u002Fgen-efficientnet-pytorch\u002Fissues\u002F13",{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},21437,"导出模型到 ONNX 时遇到 'Couldn't export Python operator SwishAutoFn' 错误或段错误怎么办？","这通常是因为 PyTorch 或 ONNX 版本过新，导致某些自定义算子（如 Swish）无法被正确导出。\n解决方案：\n1. 尝试降低 PyTorch 和 ONNX 的版本到较稳定的旧版本，通常能解决导出失败的问题。\n2. 确保使用的导出脚本和模型定义与当前的 PyTorch\u002FONNX 版本兼容。\n3. 导出后的 ONNX 模型可以使用任何支持相应算子版本的推理引擎（如 ONNX Runtime, TensorRT, ONNX-TensorFlow 等），不仅仅局限于 Caffe2。","https:\u002F\u002Fgithub.com\u002Frwightman\u002Fgen-efficientnet-pytorch\u002Fissues\u002F10",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},21438,"Mish 激活函数实现中为何注释掉了 `x.mul_(inner)` 这一行？","注释掉该行通常是为了避免在某些情况下出现梯度计算错误或静默失败。如果在训练过程中遇到异常，建议使用 PyTorch 的异常检测上下文管理器来定位问题：\n```python\nimport torch.autograd as autograd\n\nwith autograd.detect_anomaly():\n    # 执行你的训练循环或前向\u002F反向传播代码\n    training_loop()\n```\n虽然这会带来一定的性能开销，但能快速帮助发现梯度计算中的数值不稳定或逻辑错误。","https:\u002F\u002Fgithub.com\u002Frwightman\u002Fgen-efficientnet-pytorch\u002Fissues\u002F16",{"id":138,"question_zh":139,"answer_zh":140,"source_url":121},21439,"`tf_efficientnet` 系列模型与普通 `efficientnet` 系列模型有什么区别？","主要区别在于权重来源和填充方式：\n1. **权重来源**：`tf_` 前缀的模型（如 `tf_efficientnet_b5`）是从 Google 官方的 TensorFlow 权重转换而来的，覆盖了更多论文中的变体；而无前缀的模型是作者在 PyTorch 中从头训练的，目前仅包含较小的模型。\n2. **填充策略**：`tf_` 系列模型使用了 TensorFlow 风格的 'SAME' 填充，这在 PyTorch 中需要特殊处理才能复现。这种差异可能导致两者在输入尺寸处理和最终精度上有所不同。\n3. **精度表现**：通常情况下，`tf_` 系列模型由于使用了官方大规模训练的权重，精度会略优于作者自训的模型。\n建议优先使用 `tf_` 系列模型以获得更好的迁移学习效果。",[]]