[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-lukemelas--EfficientNet-PyTorch":3,"tool-lukemelas--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 真正成长为懂上",157379,2,"2026-04-15T23:32:42",[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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[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},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"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":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":77,"owner_email":78,"owner_twitter":78,"owner_website":79,"owner_url":80,"languages":81,"stars":89,"forks":90,"last_commit_at":91,"license":92,"difficulty_score":93,"env_os":94,"env_gpu":95,"env_ram":94,"env_deps":96,"category_tags":103,"github_topics":104,"view_count":32,"oss_zip_url":78,"oss_zip_packed_at":78,"status":17,"created_at":109,"updated_at":110,"faqs":111,"releases":142},7904,"lukemelas\u002FEfficientNet-PyTorch","EfficientNet-PyTorch","A PyTorch implementation of EfficientNet","EfficientNet-PyTorch 是谷歌高效卷积神经网络 EfficientNet 系列的 PyTorch 版本实现，旨在为开发者提供一套开箱即用的高性能图像识别模型。它解决了传统深度学习模型在精度提升时往往伴随参数量剧增和计算缓慢的痛点，通过独特的复合缩放方法，在保持轻量级的同时实现了卓越的准确率。\n\n这款工具特别适合人工智能研究人员、算法工程师以及需要快速部署视觉应用的学生使用。用户只需几行代码即可加载从 B0 到 B8 等多种预训练模型，大幅降低了复现前沿论文和构建生产级应用的门槛。其技术亮点包括支持内存高效的 Swish 激活函数以优化显存占用，提供基于对抗训练（AdvProp）的特殊预训练权重以提升鲁棒性，并持续跟进最新的 EfficientNetV2 架构。此外，它还灵活兼容 PyTorch JIT 导出功能，方便模型在不同环境下的部署与加速。无论是进行学术研究还是工业落地，EfficientNet-PyTorch 都是一个兼顾效率与性能的可靠选择。","# EfficientNet PyTorch\n\n### Quickstart\n\nInstall with `pip install efficientnet_pytorch` and load a pretrained EfficientNet with:\n```python\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_pretrained('efficientnet-b0')\n```\n\n### Updates\n\n#### Update (April 2, 2021)\n\nThe [EfficientNetV2 paper](https:\u002F\u002Farxiv.org\u002Fabs\u002F2104.00298) has been released! I am working on implementing it as you read this :) \n\nAbout EfficientNetV2:\n> EfficientNetV2 is a new family of convolutional networks that have faster training speed and better parameter efficiency than previous models. To develop this family of models, we use a combination of training-aware neural architecture search and scaling, to jointly optimize training speed and parameter efficiency. The models were searched from the search space enriched with new ops such as Fused-MBConv. \n\nHere is a comparison: \n> \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flukemelas_EfficientNet-PyTorch_readme_b49de6dec354.png\" width=\"100%\" \u002F>\n\n\n#### Update (Aug 25, 2020)\n\nThis update adds: \n * A new `include_top` (default: `True`) option ([#208](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F208))\n * Continuous testing with [sotabench](https:\u002F\u002Fsotabench.com\u002F)\n * Code quality improvements and fixes ([#215](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F215) [#223](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F223))\n\n#### Update (May 14, 2020)\n\nThis update adds comprehensive comments and documentation (thanks to @workingcoder).\n\n#### Update (January 23, 2020)\n\nThis update adds a new category of pre-trained model based on adversarial training, called _advprop_. It is important to note that the preprocessing required for the advprop pretrained models is slightly different from normal ImageNet preprocessing. As a result, by default, advprop models are not used. To load a model with advprop, use:\n```python\nmodel = EfficientNet.from_pretrained(\"efficientnet-b0\", advprop=True)\n```\nThere is also a new, large `efficientnet-b8` pretrained model that is only available in advprop form. When using these models, replace ImageNet preprocessing code as follows:\n```python\nif advprop:  # for models using advprop pretrained weights\n    normalize = transforms.Lambda(lambda img: img * 2.0 - 1.0)\nelse:\n    normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],\n                                     std=[0.229, 0.224, 0.225])\n```\nThis update also addresses multiple other issues ([#115](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F115), [#128](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F128)).\n\n#### Update (October 15, 2019)\n\nThis update allows you to choose whether to use a memory-efficient Swish activation. The memory-efficient version is chosen by default, but it cannot be used when exporting using PyTorch JIT. For this purpose, we have also included a standard (export-friendly) swish activation function. To switch to the export-friendly version, simply call `model.set_swish(memory_efficient=False)` after loading your desired model. This update addresses issues [#88](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F88) and [#89](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F89).\n\n#### Update (October 12, 2019)\n\nThis update makes the Swish activation function more memory-efficient. It also addresses pull requests [#72](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F72), [#73](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F73), [#85](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F85), and [#86](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F86). Thanks to the authors of all the pull requests!\n\n#### Update (July 31, 2019)\n\n_Upgrade the pip package with_ `pip install --upgrade efficientnet-pytorch`\n\nThe B6 and B7 models are now available. Additionally, _all_ pretrained models have been updated to use AutoAugment preprocessing, which translates to better performance across the board. Usage is the same as before:\n```python\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_pretrained('efficientnet-b7')\n```\n\n#### Update (June 29, 2019)\n\nThis update adds easy model exporting ([#20](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F20)) and feature extraction ([#38](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F38)).\n\n * [Example: Export to ONNX](#example-export)\n * [Example: Extract features](#example-feature-extraction)\n * Also: fixed a CUDA\u002FCPU bug ([#32](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F32))\n\nIt is also now incredibly simple to load a pretrained model with a new number of classes for transfer learning:\n```python\nmodel = EfficientNet.from_pretrained('efficientnet-b1', num_classes=23)\n```\n\n\n#### Update (June 23, 2019)\n\nThe B4 and B5 models are now available. Their usage is identical to the other models:\n```python\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_pretrained('efficientnet-b4')\n```\n\n### Overview\nThis repository contains an op-for-op PyTorch reimplementation of [EfficientNet](https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.11946), along with pre-trained models and examples.\n\nThe goal of this implementation is to be simple, highly extensible, and easy to integrate into your own projects. This implementation is a work in progress -- new features are currently being implemented.\n\nAt the moment, you can easily:\n * Load pretrained EfficientNet models\n * Use EfficientNet models for classification or feature extraction\n * Evaluate EfficientNet models on ImageNet or your own images\n\n_Upcoming features_: In the next few days, you will be able to:\n * Train new models from scratch on ImageNet with a simple command\n * Quickly finetune an EfficientNet on your own dataset\n * Export EfficientNet models for production\n\n### Table of contents\n1. [About EfficientNet](#about-efficientnet)\n2. [About EfficientNet-PyTorch](#about-efficientnet-pytorch)\n3. [Installation](#installation)\n4. [Usage](#usage)\n    * [Load pretrained models](#loading-pretrained-models)\n    * [Example: Classify](#example-classification)\n    * [Example: Extract features](#example-feature-extraction)\n    * [Example: Export to ONNX](#example-export)\n6. [Contributing](#contributing)\n\n### About EfficientNet\n\nIf you're new to EfficientNets, here is an explanation straight from the official TensorFlow implementation:\n\nEfficientNets are a family of image classification models, which achieve state-of-the-art accuracy, yet being an order-of-magnitude smaller and faster than previous models. We develop EfficientNets based on AutoML and Compound Scaling. In particular, we first use [AutoML Mobile framework](https:\u002F\u002Fai.googleblog.com\u002F2018\u002F08\u002Fmnasnet-towards-automating-design-of.html) to develop a mobile-size baseline network, named as EfficientNet-B0; Then, we use the compound scaling method to scale up this baseline to obtain EfficientNet-B1 to B7.\n\n\u003Ctable border=\"0\">\n\u003Ctr>\n    \u003Ctd>\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flukemelas_EfficientNet-PyTorch_readme_8e6e4c13294e.png\" width=\"100%\" \u002F>\n    \u003C\u002Ftd>\n    \u003Ctd>\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flukemelas_EfficientNet-PyTorch_readme_7f3fa002f263.png\", width=\"90%\" \u002F>\n    \u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\n\nEfficientNets achieve state-of-the-art accuracy on ImageNet with an order of magnitude better efficiency:\n\n\n* In high-accuracy regime, our EfficientNet-B7 achieves state-of-the-art 84.4% top-1 \u002F 97.1% top-5 accuracy on ImageNet with 66M parameters and 37B FLOPS, being 8.4x smaller and 6.1x faster on CPU inference than previous best [Gpipe](https:\u002F\u002Farxiv.org\u002Fabs\u002F1811.06965).\n\n* In middle-accuracy regime, our EfficientNet-B1 is 7.6x smaller and 5.7x faster on CPU inference than [ResNet-152](https:\u002F\u002Farxiv.org\u002Fabs\u002F1512.03385), with similar ImageNet accuracy.\n\n* Compared with the widely used [ResNet-50](https:\u002F\u002Farxiv.org\u002Fabs\u002F1512.03385), our EfficientNet-B4 improves the top-1 accuracy from 76.3% of ResNet-50 to 82.6% (+6.3%), under similar FLOPS constraint.\n\n### About EfficientNet PyTorch\n\nEfficientNet PyTorch is a PyTorch re-implementation of EfficientNet. It is consistent with the [original TensorFlow implementation](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet), such that it is easy to load weights from a TensorFlow checkpoint. At the same time, we aim to make our PyTorch implementation as simple, flexible, and extensible as possible.\n\nIf you have any feature requests or questions, feel free to leave them as GitHub issues!\n\n### Installation\n\nInstall via pip:\n```bash\npip install efficientnet_pytorch\n```\n\nOr install from source:\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\ncd EfficientNet-Pytorch\npip install -e .\n```\n\n### Usage\n\n#### Loading pretrained models\n\nLoad an EfficientNet:\n```python\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_name('efficientnet-b0')\n```\n\nLoad a pretrained EfficientNet:\n```python\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_pretrained('efficientnet-b0')\n```\n\nDetails about the models are below:\n\n|    *Name*         |*# Params*|*Top-1 Acc.*|*Pretrained?*|\n|:-----------------:|:--------:|:----------:|:-----------:|\n| `efficientnet-b0` |   5.3M   |    76.3    |      ✓      |\n| `efficientnet-b1` |   7.8M   |    78.8    |      ✓      |\n| `efficientnet-b2` |   9.2M   |    79.8    |      ✓      |\n| `efficientnet-b3` |    12M   |    81.1    |      ✓      |\n| `efficientnet-b4` |    19M   |    82.6    |      ✓      |\n| `efficientnet-b5` |    30M   |    83.3    |      ✓      |\n| `efficientnet-b6` |    43M   |    84.0    |      ✓      |\n| `efficientnet-b7` |    66M   |    84.4    |      ✓      |\n\n\n#### Example: Classification\n\nBelow is a simple, complete example. It may also be found as a jupyter notebook in `examples\u002Fsimple` or as a [Colab Notebook](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1Jw28xZ1NJq4Cja4jLe6tJ6_F5lCzElb4).\n\nWe assume that in your current directory, there is a `img.jpg` file and a `labels_map.txt` file (ImageNet class names). These are both included in `examples\u002Fsimple`.\n\n```python\nimport json\nfrom PIL import Image\nimport torch\nfrom torchvision import transforms\n\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_pretrained('efficientnet-b0')\n\n# Preprocess image\ntfms = transforms.Compose([transforms.Resize(224), transforms.ToTensor(),\n    transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),])\nimg = tfms(Image.open('img.jpg')).unsqueeze(0)\nprint(img.shape) # torch.Size([1, 3, 224, 224])\n\n# Load ImageNet class names\nlabels_map = json.load(open('labels_map.txt'))\nlabels_map = [labels_map[str(i)] for i in range(1000)]\n\n# Classify\nmodel.eval()\nwith torch.no_grad():\n    outputs = model(img)\n\n# Print predictions\nprint('-----')\nfor idx in torch.topk(outputs, k=5).indices.squeeze(0).tolist():\n    prob = torch.softmax(outputs, dim=1)[0, idx].item()\n    print('{label:\u003C75} ({p:.2f}%)'.format(label=labels_map[idx], p=prob*100))\n```\n\n#### Example: Feature Extraction\n\nYou can easily extract features with `model.extract_features`:\n```python\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_pretrained('efficientnet-b0')\n\n# ... image preprocessing as in the classification example ...\nprint(img.shape) # torch.Size([1, 3, 224, 224])\n\nfeatures = model.extract_features(img)\nprint(features.shape) # torch.Size([1, 1280, 7, 7])\n```\n\n#### Example: Export to ONNX\n\nExporting to ONNX for deploying to production is now simple:\n```python\nimport torch\nfrom efficientnet_pytorch import EfficientNet\n\nmodel = EfficientNet.from_pretrained('efficientnet-b1')\ndummy_input = torch.randn(10, 3, 240, 240)\n\nmodel.set_swish(memory_efficient=False)\ntorch.onnx.export(model, dummy_input, \"test-b1.onnx\", verbose=True)\n```\n\n[Here](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1rOAEXeXHaA8uo3aG2YcFDHItlRJMV0VP) is a Colab example.\n\n\n#### ImageNet\n\nSee `examples\u002Fimagenet` for details about evaluating on ImageNet.\n\n### Contributing\n\nIf you find a bug, create a GitHub issue, or even better, submit a pull request. Similarly, if you have questions, simply post them as GitHub issues.\n\nI look forward to seeing what the community does with these models!\n","# EfficientNet PyTorch\n\n### 快速入门\n\n使用 `pip install efficientnet_pytorch` 安装，并通过以下代码加载预训练的 EfficientNet 模型：\n```python\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_pretrained('efficientnet-b0')\n```\n\n### 更新日志\n\n#### 更新（2021年4月2日）\n\n[EfficientNetV2 论文](https:\u002F\u002Farxiv.org\u002Fabs\u002F2104.00298) 已发布！在您阅读本文时，我正在着手实现它 :) \n\n关于 EfficientNetV2：\n> EfficientNetV2 是一个新的卷积神经网络系列，其训练速度更快，参数效率也优于之前的模型。为了开发这一系列模型，我们结合了训练感知的神经架构搜索和缩放技术，以共同优化训练速度和参数效率。这些模型是从包含 Fused-MBConv 等新操作符的搜索空间中搜索出来的。\n\n以下是对比图：\n> \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flukemelas_EfficientNet-PyTorch_readme_b49de6dec354.png\" width=\"100%\" \u002F>\n\n\n#### 更新（2020年8月25日）\n\n本次更新新增：\n * 一个新的 `include_top` 参数（默认为 `True`）([#208](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F208))\n * 使用 [sotabench](https:\u002F\u002Fsotabench.com\u002F) 进行持续测试\n * 代码质量改进及修复 ([#215](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F215) 和 [#223](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F223))\n\n#### 更新（2020年5月14日）\n\n本次更新增加了全面的注释和文档说明（感谢 @workingcoder）。\n\n#### 更新（2020年1月23日）\n\n本次更新新增了一类基于对抗训练的预训练模型，称为 _advprop_。需要注意的是，advprop 预训练模型所需的预处理与常规 ImageNet 预处理略有不同。因此，默认情况下不会使用 advprop 模型。若要加载 advprop 模型，请使用以下代码：\n```python\nmodel = EfficientNet.from_pretrained(\"efficientnet-b0\", advprop=True)\n```\n此外，还有一个新的大型 `efficientnet-b8` 预训练模型，仅以 advprop 形式提供。使用这些模型时，请按如下方式替换 ImageNet 预处理代码：\n```python\nif advprop:  # 对于使用 advprop 预训练权重的模型\n    normalize = transforms.Lambda(lambda img: img * 2.0 - 1.0)\nelse:\n    normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],\n                                     std=[0.229, 0.224, 0.225])\n```\n此次更新还解决了多个其他问题 ([#115](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F115), [#128](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F128))。\n\n#### 更新（2019年10月15日）\n\n本次更新允许您选择是否使用内存高效的 Swish 激活函数。默认选择内存高效的版本，但在使用 PyTorch JIT 导出时无法使用该版本。为此，我们也提供了标准的（适合导出的）Swish 激活函数。要切换到适合导出的版本，只需在加载所需模型后调用 `model.set_swish(memory_efficient=False)`。此次更新解决了 [#88](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F88) 和 [#89](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F89) 中的问题。\n\n#### 更新（2019年10月12日）\n\n本次更新使 Swish 激活函数更加节省内存。同时，也解决了 [#72](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F72), [#73](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F73), [#85](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F85) 和 [#86](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fpull\u002F86) 中的请求。感谢所有提交请求的作者！\n\n#### 更新（2019年7月31日）\n\n请使用 `pip install --upgrade efficientnet-pytorch` 升级 pip 包。\n\n现在 B6 和 B7 模型已上线。此外，所有预训练模型均已更新为使用 AutoAugment 预处理，这将带来整体性能的提升。使用方法与之前相同：\n```python\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_pretrained('efficientnet-b7')\n```\n\n#### 更新（2019年6月29日）\n\n本次更新增加了便捷的模型导出功能 ([#20](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F20)) 和特征提取功能 ([#38](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F38))。\n\n * [示例：导出为 ONNX 格式](#example-export)\n * [示例：特征提取](#example-feature-extraction)\n * 此外：修复了一个 CUDA\u002FCPU 错误 ([#32](https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F32))\n\n现在，加载一个具有新类别数目的预训练模型进行迁移学习也变得非常简单：\n```python\nmodel = EfficientNet.from_pretrained('efficientnet-b1', num_classes=23)\n```\n\n\n#### 更新（2019年6月23日）\n\nB4 和 B5 模型现已上线。它们的使用方式与其他模型完全相同：\n```python\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_pretrained('efficientnet-b4')\n```\n\n### 概述\n本仓库包含了对 [EfficientNet](https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.11946) 的逐层 PyTorch 重实现，以及预训练模型和示例。\n\n该实现的目标是简单易用、高度可扩展，并且易于集成到您自己的项目中。目前该实现仍在开发中——新功能正在不断添加。\n\n现阶段，您可以轻松地：\n * 加载预训练的 EfficientNet 模型\n * 将 EfficientNet 模型用于分类或特征提取\n * 在 ImageNet 或您自己的数据集上评估 EfficientNet 模型\n\n_即将推出的功能_：在未来几天内，您将能够：\n * 使用一条简单的命令从头开始在 ImageNet 上训练新模型\n * 快速地在您自己的数据集上微调 EfficientNet 模型\n * 将 EfficientNet 模型导出用于生产环境\n\n### 目录\n1. [关于 EfficientNet](#about-efficientnet)\n2. [关于 EfficientNet-PyTorch](#about-efficientnet-pytorch)\n3. [安装](#installation)\n4. [使用](#usage)\n    * [加载预训练模型](#loading-pretrained-models)\n    * [示例：分类](#example-classification)\n    * [示例：特征提取](#example-feature-extraction)\n    * [示例：导出为 ONNX 格式](#example-export)\n6. [贡献](#contributing)\n\n### 关于 EfficientNet\n\n如果你是第一次接触 EfficientNet，以下是来自 TensorFlow 官方实现的直接解释：\n\nEfficientNet 是一系列图像分类模型，它们不仅达到了最先进的准确率，而且在规模和速度上都比之前的模型小了一个数量级。我们基于 AutoML 和复合缩放方法开发了 EfficientNet。具体来说，我们首先使用 [AutoML Mobile 框架](https:\u002F\u002Fai.googleblog.com\u002F2018\u002F08\u002Fmnasnet-towards-automating-design-of.html) 来构建一个移动端大小的基准网络，命名为 EfficientNet-B0；然后，我们采用复合缩放方法将该基准网络逐步放大，从而得到 EfficientNet-B1 到 B7。\n\n\u003Ctable border=\"0\">\n\u003Ctr>\n    \u003Ctd>\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flukemelas_EfficientNet-PyTorch_readme_8e6e4c13294e.png\" width=\"100%\" \u002F>\n    \u003C\u002Ftd>\n    \u003Ctd>\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flukemelas_EfficientNet-PyTorch_readme_7f3fa002f263.png\", width=\"90%\" \u002F>\n    \u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\n\nEfficientNet 在 ImageNet 数据集上实现了最先进的准确率，同时效率提升了整整一个数量级：\n\n\n* 在高准确率场景下，我们的 EfficientNet-B7 在 ImageNet 上达到了 84.4% 的 top-1 准确率和 97.1% 的 top-5 准确率，参数量仅为 6600 万，浮点运算次数为 370 亿，相比此前的最佳模型 [Gpipe](https:\u002F\u002Farxiv.org\u002Fabs\u002F1811.06965)，其规模缩小了 8.4 倍，CPU 推理速度提升了 6.1 倍。\n\n* 在中等准确率场景下，我们的 EfficientNet-B1 在 CPU 推理速度上比 [ResNet-152](https:\u002F\u002Farxiv.org\u002Fabs\u002F1512.03385) 快 5.7 倍，而参数量仅为其 7.6 分之一，且在 ImageNet 上的准确率相近。\n\n* 与广泛使用的 [ResNet-50](https:\u002F\u002Farxiv.org\u002Fabs\u002F1512.03385) 相比，在相似的浮点运算次数约束下，我们的 EfficientNet-B4 将 top-1 准确率从 ResNet-50 的 76.3% 提升至 82.6%（提高了 6.3%）。\n\n### 关于 EfficientNet PyTorch\n\nEfficientNet PyTorch 是 EfficientNet 的 PyTorch 重新实现版本。它与 [原始的 TensorFlow 实现](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Ftpu\u002Ftree\u002Fmaster\u002Fmodels\u002Fofficial\u002Fefficientnet) 保持一致，因此可以轻松地从 TensorFlow 检查点加载权重。与此同时，我们致力于使我们的 PyTorch 实现尽可能简单、灵活且易于扩展。\n\n如果你有任何功能请求或问题，请随时在 GitHub 上提交 Issue！\n\n### 安装\n\n通过 pip 安装：\n```bash\npip install efficientnet_pytorch\n```\n\n或者从源码安装：\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\ncd EfficientNet-PyTorch\npip install -e .\n```\n\n### 使用\n\n#### 加载预训练模型\n\n加载一个 EfficientNet 模型：\n```python\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_name('efficientnet-b0')\n```\n\n加载一个预训练的 EfficientNet 模型：\n```python\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_pretrained('efficientnet-b0')\n```\n\n以下是各模型的详细信息：\n\n|    *名称*         |*参数量*|*Top-1 准确率*|*是否预训练？*|\n|:-----------------:|:--------:|:----------:|:-----------:|\n| `efficientnet-b0` |   5.3M   |    76.3    |      ✓      |\n| `efficientnet-b1` |   7.8M   |    78.8    |      ✓      |\n| `efficientnet-b2` |   9.2M   |    79.8    |      ✓      |\n| `efficientnet-b3` |    12M   |    81.1    |      ✓      |\n| `efficientnet-b4` |    19M   |    82.6    |      ✓      |\n| `efficientnet-b5` |    30M   |    83.3    |      ✓      |\n| `efficientnet-b6` |    43M   |    84.0    |      ✓      |\n| `efficientnet-b7` |    66M   |    84.4    |      ✓      |\n\n\n#### 示例：分类任务\n\n以下是一个简单完整的示例。你也可以在 `examples\u002Fsimple` 中找到对应的 Jupyter Notebook，或者在 [Colab Notebook](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1Jw28xZ1NJq4Cja4jLe6tJ6_F5lCzElb4) 中查看。\n\n假设你的当前目录下有一个 `img.jpg` 文件和一个 `labels_map.txt` 文件（包含 ImageNet 类别名称）。这两个文件都包含在 `examples\u002Fsimple` 中。\n\n```python\nimport json\nfrom PIL import Image\nimport torch\nfrom torchvision import transforms\n\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_pretrained('efficientnet-b0')\n\n# 图像预处理\ntfms = transforms.Compose([transforms.Resize(224), transforms.ToTensor(),\n    transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),])\nimg = tfms(Image.open('img.jpg')).unsqueeze(0)\nprint(img.shape) # torch.Size([1, 3, 224, 224])\n\n# 加载 ImageNet 类别名称\nlabels_map = json.load(open('labels_map.txt'))\nlabels_map = [labels_map[str(i)] for i in range(1000)]\n\n# 分类\nmodel.eval()\nwith torch.no_grad():\n    outputs = model(img)\n\n# 打印预测结果\nprint('-----')\nfor idx in torch.topk(outputs, k=5).indices.squeeze(0).tolist():\n    prob = torch.softmax(outputs, dim=1)[0, idx].item()\n    print('{label:\u003C75} ({p:.2f}%)'.format(label=labels_map[idx], p=prob*100))\n```\n\n#### 示例：特征提取\n\n你可以使用 `model.extract_features` 轻松提取特征：\n```python\nfrom efficientnet_pytorch import EfficientNet\nmodel = EfficientNet.from_pretrained('efficientnet-b0')\n\n# ... 图像预处理步骤同分类示例 ...\nprint(img.shape) # torch.Size([1, 3, 224, 224])\n\nfeatures = model.extract_features(img)\nprint(features.shape) # torch.Size([1, 1280, 7, 7])\n```\n\n#### 示例：导出为 ONNX\n\n现在，将模型导出为 ONNX 以用于生产部署变得非常简单：\n```python\nimport torch\nfrom efficientnet_pytorch import EfficientNet\n\nmodel = EfficientNet.from_pretrained('efficientnet-b1')\ndummy_input = torch.randn(10, 3, 240, 240)\n\nmodel.set_swish(memory_efficient=False)\ntorch.onnx.export(model, dummy_input, \"test-b1.onnx\", verbose=True)\n```\n\n[这里](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1rOAEXeXHaA8uo3aG2YcFDHItlRJMV0VP) 是一个 Colab 示例。\n\n\n#### ImageNet\n\n有关在 ImageNet 上评估的详细信息，请参阅 `examples\u002Fimagenet`。\n\n### 贡献\n\n如果你发现任何错误，请创建一个 GitHub 问题，或者更好的是，提交一个拉取请求。同样地，如果你有任何疑问，也请直接在 GitHub 上提出。\n\n我非常期待看到社区如何利用这些模型！","# EfficientNet-PyTorch 快速上手指南\n\nEfficientNet-PyTorch 是 Google EfficientNet 系列模型的 PyTorch 复现版本，提供了从 B0 到 B7 多种预训练模型。该库以高精度、低参数量和高推理速度著称，非常适合图像分类和特征提取任务。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**：Linux, macOS, 或 Windows\n*   **Python 版本**：推荐 Python 3.6 及以上\n*   **核心依赖**：\n    *   `torch` (PyTorch)\n    *   `torchvision`\n    *   `Pillow` (用于图像处理)\n    *   `numpy`\n\n您可以使用以下命令检查 PyTorch 是否已安装：\n```bash\npython -c \"import torch; print(torch.__version__)\"\n```\n\n## 安装步骤\n\n推荐使用 pip 进行安装。为了提高下载速度，国内用户建议使用清华或阿里镜像源。\n\n### 方式一：通过 pip 安装（推荐）\n\n**使用国内镜像源加速安装：**\n```bash\npip install efficientnet_pytorch -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n**或使用官方源：**\n```bash\npip install efficientnet_pytorch\n```\n\n### 方式二：从源码安装\n\n如果您需要最新的功能或贡献代码，可以从 GitHub 克隆源码安装：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\ncd EfficientNet-PyTorch\npip install -e .\n```\n\n## 基本使用\n\n以下是加载预训练模型并进行图像分类的最简示例。\n\n### 1. 加载预训练模型\n\n只需一行代码即可加载指定的 EfficientNet 模型（如 `efficientnet-b0`）。模型权重会自动下载并缓存。\n\n```python\nfrom efficientnet_pytorch import EfficientNet\n\n# 加载预训练的 efficientnet-b0 模型\nmodel = EfficientNet.from_pretrained('efficientnet-b0')\n\n# 将模型设置为评估模式\nmodel.eval()\n```\n\n支持的模型名称包括：`efficientnet-b0` 至 `efficientnet-b7`。\n\n### 2. 图像预处理与推理\n\nEfficientNet 需要特定的图像预处理（缩放、转 Tensor、标准化）。以下是一个完整的分类示例：\n\n```python\nimport torch\nfrom PIL import Image\nfrom torchvision import transforms\nfrom efficientnet_pytorch import EfficientNet\n\n# 1. 加载模型\nmodel = EfficientNet.from_pretrained('efficientnet-b0')\nmodel.eval()\n\n# 2. 定义预处理流程\n# 注意：EfficientNet 通常需要将图像缩放到对应模型的分辨率 (B0 为 224x224)\ntfms = transforms.Compose([\n    transforms.Resize(224),\n    transforms.ToTensor(),\n    transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),\n])\n\n# 3. 加载并处理图像\nimg = Image.open('img.jpg') # 替换为您的图片路径\nimg_tensor = tfms(img).unsqueeze(0) # 增加 batch 维度 [1, 3, 224, 224]\n\n# 4. 执行推理\nwith torch.no_grad():\n    outputs = model(img_tensor)\n\n# 5. 获取预测结果 (Top-1)\npredicted_class_idx = outputs.argmax(dim=1).item()\nprint(f\"预测类别索引：{predicted_class_idx}\")\n\n# 如果需要获取概率分布\nprobabilities = torch.softmax(outputs, dim=1)[0]\nprint(f\"最高置信度：{probabilities[predicted_class_idx].item():.4f}\")\n```\n\n### 3. 提取特征\n\n如果您需要将 EfficientNet 作为骨干网络用于其他任务（如检测、分割），可以使用 `extract_features` 方法直接获取中间层特征图，而不经过最后的分类层：\n\n```python\nfrom efficientnet_pytorch import EfficientNet\nimport torch\n\nmodel = EfficientNet.from_pretrained('efficientnet-b0')\nmodel.eval()\n\n# 假设 img_tensor 已经过预处理，形状为 [1, 3, 224, 224]\nfeatures = model.extract_features(img_tensor)\n\n# 输出特征图形状，例如: torch.Size([1, 1280, 7, 7])\nprint(features.shape)\n```","某医疗影像初创公司的算法团队正致力于开发一套肺结节自动筛查系统，需要在有限的 GPU 资源下快速迭代高精度的分类模型。\n\n### 没有 EfficientNet-PyTorch 时\n- **模型选型困难**：团队需手动复现复杂的复合缩放（Compound Scaling）架构，耗费数周时间调试网络层级与参数，极易出错。\n- **训练效率低下**：沿用传统的 ResNet 或 Inception 模型，参数量巨大导致在单卡环境下训练缓慢，难以进行充分的超参数搜索。\n- **精度遭遇瓶颈**：在小型医疗数据集上，旧有模型要么过拟合严重，要么特征提取能力不足，漏诊率始终无法降至安全线以下。\n- **部署成本高昂**：庞大的模型体积使得将其移植到边缘检测设备（如便携式超声仪）时，推理延迟过高，无法满足实时性要求。\n\n### 使用 EfficientNet-PyTorch 后\n- **极速集成架构**：通过 `pip install efficientnet_pytorch` 及一行代码 `EfficientNet.from_pretrained('efficientnet-b4')`，直接加载经过 AutoAugment 预训练的 SOTA 模型，将环境搭建时间从数周缩短至几分钟。\n- **训练大幅加速**：得益于其独特的 MBConv 模块和内存优化版 Swish 激活函数，在相同硬件条件下训练速度提升显著，团队能在一天内完成多轮实验验证。\n- **精度显著提升**：利用其在 ImageNet 上卓越的参数效率，模型在小样本医疗数据上展现出更强的泛化能力，肺结节识别准确率提升了 5%，有效降低了漏诊风险。\n- **轻松边缘部署**：EfficientNet 系列以更少的参数量实现了更高的精度，模型体积小巧，顺利部署于低算力边缘设备，推理延迟降低至毫秒级。\n\nEfficientNet-PyTorch 通过提供开箱即用的高性能预训练模型，让研发团队在资源受限的情况下，同时实现了训练速度的飞跃与诊断精度的突破。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Flukemelas_EfficientNet-PyTorch_b49de6de.png","lukemelas","Luke Melas-Kyriazi","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Flukemelas_747d4cf3.jpg","Building @getcursor. Previously Rhodes Scholar and a PhD student at Oxford University. Always open to meeting interesting people!","Anysphere (Cursor)","San Francisco, CA",null,"https:\u002F\u002Flukemelas.github.io\u002F","https:\u002F\u002Fgithub.com\u002Flukemelas",[82,86],{"name":83,"color":84,"percentage":85},"Python","#3572A5",98,{"name":87,"color":88,"percentage":32},"Shell","#89e051",8219,1539,"2026-04-15T02:41:29","Apache-2.0",1,"未说明","非必需（支持 CPU 推理），若使用 GPU 需兼容 PyTorch 的 CUDA 环境，具体显存取决于模型大小（如 efficientnet-b7 参数量 66M）",{"notes":97,"python":94,"dependencies":98},"该库可通过 pip 直接安装。默认使用内存优化的 Swish 激活函数，但若需导出为 ONNX 格式，必须调用 model.set_swish(memory_efficient=False) 切换为标准版本。加载 advprop 预训练模型时，图像预处理方式与标准 ImageNet 不同（需将像素值映射到 [-1, 1] 而非标准化）。支持从 B0 到 B7 多种规模的预训练模型，较大模型（如 B7）对显存要求更高。",[99,100,101,102],"torch","torchvision","Pillow","efficientnet_pytorch",[15,14],[105,106,107,108],"efficientnet-pytorch","imagenet","feature-extraction","pretrained-models","2026-03-27T02:49:30.150509","2026-04-16T08:11:56.816438",[112,117,122,127,132,137],{"id":113,"question_zh":114,"answer_zh":115,"source_url":116},35402,"为什么使用 AdvProp 预训练权重进行训练时，结果不稳定且准确率下降？","如果您只是加载了 AdvProp 的预训练权重，但没有在训练过程中实现 AdvProp 特有的归一化方法（AdvProp normalization），那么训练准确率肯定会下降。AdvProp 需要配合特定的对抗样本生成和不同的归一化策略才能发挥作用，仅替换权重而不改变训练流程会导致模型表现不佳。","https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F115",{"id":118,"question_zh":119,"answer_zh":120,"source_url":121},35403,"为什么计算出的 FLOPs 与论文中的数据不一致？","主要原因通常是输入图像尺寸设置错误。论文中不同型号的 EfficientNet（如 B0 到 B7）使用的是可变分辨率的输入图像，而很多用户在测试时对所有模型都统一使用了 (3, 224, 224) 的输入尺寸，导致计算结果偏差。请确保根据具体模型型号调整输入分辨率。此外，请确认您使用的是该库的最新版本，因为架构修复可能影响计算结果。","https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F17",{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},35404,"如何正确加载预训练 EfficientNet 并修改最后的全连接层以适应自定义分类任务？","不要直接通过 `model.children()` 截取部分层来构建新模型，这可能导致前向传播错误。推荐的做法是直接使用库提供的接口或正确访问特征提取部分。如果必须自定义，请确保正确实例化 `EfficientNet.from_pretrained()`，然后替换 `_fc` 层。例如：\n```python\nmodel = EfficientNet.from_pretrained('efficientnet-b0')\nnum_ftrs = model._fc.in_features\nmodel._fc = nn.Linear(num_ftrs, your_num_classes)\n```\n避免手动拆解模块导致的前向函数未实现错误。","https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F38",{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},35405,"如何将 EfficientNet PyTorch 模型导出为 ONNX 格式？遇到 'silu' 算子不支持或非常量属性错误怎么办？","导出 ONNX 时需要关闭内存优化的 Swish 激活函数，因为它是动态的且不被 ONNX 支持。请在导出前执行以下代码：\n```python\nmodel = EfficientNet.from_name('efficientnet-b0')\nmodel.eval()\n# 关键步骤：禁用内存高效版 Swish，改用标准版以兼容 ONNX\nmodel.set_swish(memory_efficient=False)\ntorch.onnx.export(model, torch.rand(1, 3, 240, 240), \"EfficientNet-B0.onnx\", opset_version=11)\n```\n如果遇到 kernel size 非常量的错误，请确保模型中没有动态变化的参数，并尝试提高 `opset_version`（如设为 11 或更高）。","https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F20",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},35406,"训练时出现 'CUDA out of memory' 错误，如何解决显存不足的问题？","该问题通常由默认的内存高效型 Swish 激活函数在某些旧版本或特定硬件上引起。最新版本的仓库已默认修复此问题。如果您仍遇到显存溢出，可以尝试显式设置：\n```python\nmodel.set_swish(memory_efficient=True)  # 默认即为 True，节省显存但不可导出 ONNX\n```\n如果为了导出 ONNX 而设置了 `memory_efficient=False` 导致显存爆炸，请在训练阶段保持 `memory_efficient=True`，仅在导出前临时切换为 `False`。同时，减小 batch size 也是直接的缓解方案。","https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F18",{"id":138,"question_zh":139,"answer_zh":140,"source_url":141},35407,"下载预训练权重时出现 'HTTP Error 403: Forbidden' 错误，该如何解决？","此错误通常是因为使用的库版本过旧，其中包含的预训练模型下载链接已失效或权限变更。解决方法是升级 efficientnet-pytorch 到最新版本：\n```bash\npip install --upgrade efficientnet-pytorch\n```\n维护者已在新版本中更新了 `url_map` 字典中的有效链接。如果无法升级，需手动查找最新的 `.pth` 文件地址并修改源码中的 URL 映射。","https:\u002F\u002Fgithub.com\u002Flukemelas\u002FEfficientNet-PyTorch\u002Fissues\u002F138",[143],{"id":144,"version":145,"summary_zh":146,"released_at":147},280478,"1.0","本版本包含 EfficientNet 的预训练模型（带 AdvProp 训练和不带 AdvProp 训练两种）。\r\n\r\n后续版本将包含 Noisy Student 模型及其他模型。","2020-03-01T03:29:43"]