[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-Lasagne--Lasagne":3,"tool-Lasagne--Lasagne":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":64,"owner_name":64,"owner_avatar_url":72,"owner_bio":73,"owner_company":74,"owner_location":74,"owner_email":74,"owner_twitter":74,"owner_website":74,"owner_url":75,"languages":76,"stars":81,"forks":82,"last_commit_at":83,"license":84,"difficulty_score":85,"env_os":86,"env_gpu":87,"env_ram":86,"env_deps":88,"category_tags":93,"github_topics":94,"view_count":32,"oss_zip_url":74,"oss_zip_packed_at":74,"status":17,"created_at":99,"updated_at":100,"faqs":101,"releases":130},8049,"Lasagne\u002FLasagne","Lasagne","Lightweight library to build and train neural networks in Theano","Lasagne 是一个基于 Theano 构建的轻量级 Python 库，旨在帮助开发者高效地搭建和训练各类神经网络。它主要解决了深度学习模型开发中代码复用难、梯度推导繁琐以及硬件适配复杂等痛点，让用户能专注于网络结构的设计而非底层数学细节。\n\n这款工具特别适合人工智能研究人员、算法工程师及深度学习爱好者使用。无论是需要处理图像识别的卷积神经网络（CNN），还是处理序列数据的长短期记忆网络（LSTM），亦或是更复杂的多输入多输出架构，Lasagne 都能提供简洁灵活的模块化支持。\n\n其核心技术亮点在于完美继承了 Theano 的符号微分能力，用户无需手动推导梯度即可自由定义损失函数；同时，它能透明地调度 CPU 或 GPU 资源，自动优化计算性能。Lasagne 秉持“简约、透明、实用”的设计哲学，不隐藏底层逻辑，允许各组件独立使用，既降低了入门门槛，又为高级定制留足了空间。通过几行清晰的代码，用户即可快速原型化复杂的深度学习模型，是学术研究与工程实践的理想助手。",".. image:: https:\u002F\u002Freadthedocs.org\u002Fprojects\u002Flasagne\u002Fbadge\u002F\n    :target: http:\u002F\u002Flasagne.readthedocs.org\u002Fen\u002Flatest\u002F\n\n.. image:: https:\u002F\u002Ftravis-ci.org\u002FLasagne\u002FLasagne.svg\n    :target: https:\u002F\u002Ftravis-ci.org\u002FLasagne\u002FLasagne\n\n.. image:: https:\u002F\u002Fimg.shields.io\u002Fcoveralls\u002FLasagne\u002FLasagne.svg\n    :target: https:\u002F\u002Fcoveralls.io\u002Fr\u002FLasagne\u002FLasagne\n\n.. image:: https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-blue.svg\n    :target: https:\u002F\u002Fgithub.com\u002FLasagne\u002FLasagne\u002Fblob\u002Fmaster\u002FLICENSE\n\n.. image:: https:\u002F\u002Fzenodo.org\u002Fbadge\u002F16974\u002FLasagne\u002FLasagne.svg\n   :target: https:\u002F\u002Fzenodo.org\u002Fbadge\u002Flatestdoi\u002F16974\u002FLasagne\u002FLasagne\n\nLasagne\n=======\n\nLasagne is a lightweight library to build and train neural networks in Theano.\nIts main features are:\n\n* Supports feed-forward networks such as Convolutional Neural Networks (CNNs),\n  recurrent networks including Long Short-Term Memory (LSTM), and any\n  combination thereof\n* Allows architectures of multiple inputs and multiple outputs, including\n  auxiliary classifiers\n* Many optimization methods including Nesterov momentum, RMSprop and ADAM\n* Freely definable cost function and no need to derive gradients due to\n  Theano's symbolic differentiation\n* Transparent support of CPUs and GPUs due to Theano's expression compiler\n\nIts design is governed by `six principles\n\u003Chttp:\u002F\u002Flasagne.readthedocs.org\u002Fen\u002Flatest\u002Fuser\u002Fdevelopment.html#philosophy>`_:\n\n* Simplicity: Be easy to use, easy to understand and easy to extend, to\n  facilitate use in research\n* Transparency: Do not hide Theano behind abstractions, directly process and\n  return Theano expressions or Python \u002F numpy data types\n* Modularity: Allow all parts (layers, regularizers, optimizers, ...) to be\n  used independently of Lasagne\n* Pragmatism: Make common use cases easy, do not overrate uncommon cases\n* Restraint: Do not obstruct users with features they decide not to use\n* Focus: \"Do one thing and do it well\"\n\n\nInstallation\n------------\n\nIn short, you can install a known compatible version of Theano and the latest\nLasagne development version via:\n\n.. code-block:: bash\n\n  pip install -r https:\u002F\u002Fraw.githubusercontent.com\u002FLasagne\u002FLasagne\u002Fmaster\u002Frequirements.txt\n  pip install https:\u002F\u002Fgithub.com\u002FLasagne\u002FLasagne\u002Farchive\u002Fmaster.zip\n\nFor more details and alternatives, please see the `Installation instructions\n\u003Chttp:\u002F\u002Flasagne.readthedocs.org\u002Fen\u002Flatest\u002Fuser\u002Finstallation.html>`_.\n\n\nDocumentation\n-------------\n\nDocumentation is available online: http:\u002F\u002Flasagne.readthedocs.org\u002F\n\nFor support, please refer to the `lasagne-users mailing list\n\u003Chttps:\u002F\u002Fgroups.google.com\u002Fforum\u002F#!forum\u002Flasagne-users>`_.\n\n\nExample\n-------\n\n.. code-block:: python\n\n  import lasagne\n  import theano\n  import theano.tensor as T\n\n  # create Theano variables for input and target minibatch\n  input_var = T.tensor4('X')\n  target_var = T.ivector('y')\n\n  # create a small convolutional neural network\n  from lasagne.nonlinearities import leaky_rectify, softmax\n  network = lasagne.layers.InputLayer((None, 3, 32, 32), input_var)\n  network = lasagne.layers.Conv2DLayer(network, 64, (3, 3),\n                                       nonlinearity=leaky_rectify)\n  network = lasagne.layers.Conv2DLayer(network, 32, (3, 3),\n                                       nonlinearity=leaky_rectify)\n  network = lasagne.layers.Pool2DLayer(network, (3, 3), stride=2, mode='max')\n  network = lasagne.layers.DenseLayer(lasagne.layers.dropout(network, 0.5),\n                                      128, nonlinearity=leaky_rectify,\n                                      W=lasagne.init.Orthogonal())\n  network = lasagne.layers.DenseLayer(lasagne.layers.dropout(network, 0.5),\n                                      10, nonlinearity=softmax)\n\n  # create loss function\n  prediction = lasagne.layers.get_output(network)\n  loss = lasagne.objectives.categorical_crossentropy(prediction, target_var)\n  loss = loss.mean() + 1e-4 * lasagne.regularization.regularize_network_params(\n          network, lasagne.regularization.l2)\n\n  # create parameter update expressions\n  params = lasagne.layers.get_all_params(network, trainable=True)\n  updates = lasagne.updates.nesterov_momentum(loss, params, learning_rate=0.01,\n                                              momentum=0.9)\n\n  # compile training function that updates parameters and returns training loss\n  train_fn = theano.function([input_var, target_var], loss, updates=updates)\n\n  # train network (assuming you've got some training data in numpy arrays)\n  for epoch in range(100):\n      loss = 0\n      for input_batch, target_batch in training_data:\n          loss += train_fn(input_batch, target_batch)\n      print(\"Epoch %d: Loss %g\" % (epoch + 1, loss \u002F len(training_data)))\n\n  # use trained network for predictions\n  test_prediction = lasagne.layers.get_output(network, deterministic=True)\n  predict_fn = theano.function([input_var], T.argmax(test_prediction, axis=1))\n  print(\"Predicted class for first test input: %r\" % predict_fn(test_data[0]))\n\nFor a fully-functional example, see `examples\u002Fmnist.py \u003Cexamples\u002Fmnist.py>`_,\nand check the `Tutorial\n\u003Chttp:\u002F\u002Flasagne.readthedocs.org\u002Fen\u002Flatest\u002Fuser\u002Ftutorial.html>`_ for in-depth\nexplanations of the same. More examples, code snippets and reproductions of\nrecent research papers are maintained in the separate `Lasagne Recipes\n\u003Chttps:\u002F\u002Fgithub.com\u002FLasagne\u002FRecipes>`_ repository.\n\n\nCitation\n--------\n\nIf you find Lasagne useful for your scientific work, please consider citing it\nin resulting publications. We provide a ready-to-use `BibTeX entry for citing\nLasagne \u003Chttps:\u002F\u002Fgithub.com\u002FLasagne\u002FLasagne\u002Fwiki\u002FLasagne-Citation-(BibTeX)>`_.\n\n\nDevelopment\n-----------\n\nLasagne is a work in progress, input is welcome.\n\nPlease see the `Contribution instructions\n\u003Chttp:\u002F\u002Flasagne.readthedocs.org\u002Fen\u002Flatest\u002Fuser\u002Fdevelopment.html>`_ for details\non how you can contribute!\n",".. image:: https:\u002F\u002Freadthedocs.org\u002Fprojects\u002Flasagne\u002Fbadge\u002F\n    :target: http:\u002F\u002Flasagne.readthedocs.org\u002Fen\u002Flatest\u002F\n\n.. image:: https:\u002F\u002Ftravis-ci.org\u002FLasagne\u002FLasagne.svg\n    :target: https:\u002F\u002Ftravis-ci.org\u002FLasagne\u002FLasagne\n\n.. image:: https:\u002F\u002Fimg.shields.io\u002Fcoveralls\u002FLasagne\u002FLasagne.svg\n    :target: https:\u002F\u002Fcoveralls.io\u002Fr\u002FLasagne\u002FLasagne\n\n.. image:: https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-blue.svg\n    :target: https:\u002F\u002Fgithub.com\u002FLasagne\u002FLasagne\u002Fblob\u002Fmaster\u002FLICENSE\n\n.. image:: https:\u002F\u002Fzenodo.org\u002Fbadge\u002F16974\u002FLasagne\u002FLasagne.svg\n   :target: https:\u002F\u002Fzenodo.org\u002Fbadge\u002Flatestdoi\u002F16974\u002FLasagne\u002FLasagne\n\nLasagne\n=======\n\nLasagne 是一个轻量级的库，用于在 Theano 中构建和训练神经网络。它的主要特性包括：\n\n* 支持前馈网络，如卷积神经网络（CNN），循环网络，包括长短期记忆网络（LSTM），以及它们的任意组合。\n* 允许多输入、多输出的架构，包括辅助分类器。\n* 提供多种优化方法，包括 Nesterov 动量、RMSprop 和 ADAM。\n* 可自由定义损失函数，且由于 Theano 的符号微分功能，无需手动推导梯度。\n* 由于 Theano 的表达式编译器，能够透明地支持 CPU 和 GPU。\n\n其设计遵循 `六个原则 \u003Chttp:\u002F\u002Flasagne.readthedocs.org\u002Fen\u002Flatest\u002Fuser\u002Fdevelopment.html#philosophy>`_：\n\n* 简单性：易于使用、理解及扩展，以促进研究中的应用。\n* 透明性：不将 Theano 隐藏在抽象之下，直接处理并返回 Theano 表达式或 Python\u002Fnumpy 数据类型。\n* 模块化：允许所有组件（层、正则化项、优化器等）独立于 Lasagne 使用。\n* 实用性：简化常见用例，不过度强调不常见的场景。\n* 节制：不强迫用户使用他们决定不使用的功能。\n* 专注：做好一件事，并把它做好。\n\n\n安装\n----\n\n简而言之，你可以通过以下命令安装已知兼容版本的 Theano 和最新的 Lasagne 开发版本：\n\n.. code-block:: bash\n\n  pip install -r https:\u002F\u002Fraw.githubusercontent.com\u002FLasagne\u002FLasagne\u002Fmaster\u002Frequirements.txt\n  pip install https:\u002F\u002Fgithub.com\u002FLasagne\u002FLasagne\u002Farchive\u002Fmaster.zip\n\n更多详细信息及替代方案，请参阅 `安装说明 \u003Chttp:\u002F\u002Flasagne.readthedocs.org\u002Fen\u002Flatest\u002Fuser\u002Finstallation.html>`_。\n\n\n文档\n----\n\n文档可在在线查阅：http:\u002F\u002Flasagne.readthedocs.org\u002F\n\n如需支持，请访问 `lasagne-users 邮件列表 \u003Chttps:\u002F\u002Fgroups.google.com\u002Fforum\u002F#!forum\u002Flasagne-users>`_。\n\n\n示例\n----\n\n.. code-block:: python\n\n  import lasagne\n  import theano\n  import theano.tensor as T\n\n  # 创建用于输入和目标小批量的 Theano 变量\n  input_var = T.tensor4('X')\n  target_var = T.ivector('y')\n\n  # 构建一个小型卷积神经网络\n  from lasagne.nonlinearities import leaky_rectify, softmax\n  network = lasagne.layers.InputLayer((None, 3, 32, 32), input_var)\n  network = lasagne.layers.Conv2DLayer(network, 64, (3, 3),\n                                       nonlinearity=leaky_rectify)\n  network = lasagne.layers.Conv2DLayer(network, 32, (3, 3),\n                                       nonlinearity=leaky_rectify)\n  network = lasagne.layers.Pool2DLayer(network, (3, 3), stride=2, mode='max')\n  network = lasagne.layers.DenseLayer(lasagne.layers.dropout(network, 0.5),\n                                      128, nonlinearity=leaky_rectify,\n                                      W=lasagne.init.Orthogonal())\n  network = lasagne.layers.DenseLayer(lasagne.layers.dropout(network, 0.5),\n                                      10, nonlinearity=softmax)\n\n  # 定义损失函数\n  prediction = lasagne.layers.get_output(network)\n  loss = lasagne.objectives.categorical_crossentropy(prediction, target_var)\n  loss = loss.mean() + 1e-4 * lasagne.regularization.regularize_network_params(\n          network, lasagne.regularization.l2)\n\n  # 创建参数更新表达式\n  params = lasagne.layers.get_all_params(network, trainable=True)\n  updates = lasagne.updates.nesterov_momentum(loss, params, learning_rate=0.01,\n                                              momentum=0.9)\n\n  # 编译训练函数，该函数更新参数并返回训练损失\n  train_fn = theano.function([input_var, target_var], loss, updates=updates)\n\n  # 训练网络（假设你已经有一些训练数据存储在 numpy 数组中）\n  for epoch in range(100):\n      loss = 0\n      for input_batch, target_batch in training_data:\n          loss += train_fn(input_batch, target_batch)\n      print(\"第 %d 个 epoch：损失 %g\" % (epoch + 1, loss \u002F len(training_data)))\n\n  # 使用训练好的网络进行预测\n  test_prediction = lasagne.layers.get_output(network, deterministic=True)\n  predict_fn = theano.function([input_var], T.argmax(test_prediction, axis=1))\n  print(\"第一个测试样本的预测类别： %r\" % predict_fn(test_data[0]))\n\n完整的可运行示例请参见 `examples\u002Fmnist.py \u003Cexamples\u002Fmnist.py>`_，而更深入的解释可以在 `教程 \u003Chttp:\u002F\u002Flasagne.readthedocs.org\u002Fen\u002Flatest\u002Fuser\u002Ftutorial.html>`_ 中找到。更多示例、代码片段以及对近期研究论文的复现，都维护在单独的 `Lasagne Recipes \u003Chttps:\u002F\u002Fgithub.com\u002FLasagne\u002FRecipes>`_ 仓库中。\n\n\n引用\n----\n\n如果你在科研工作中使用了 Lasagne，请考虑在相关出版物中引用它。我们提供了一个可以直接使用的 `BibTeX 引用条目 \u003Chttps:\u002F\u002Fgithub.com\u002FLasagne\u002FLasagne\u002Fwiki\u002FLasagne-Citation-(BibTeX)>`_。\n\n\n开发\n----\n\nLasagne 目前仍在开发中，欢迎贡献意见和代码。\n\n有关如何参与贡献的详细信息，请参阅 `贡献说明 \u003Chttp:\u002F\u002Flasagne.readthedocs.org\u002Fen\u002Flatest\u002Fuser\u002Fdevelopment.html>`_！","# Lasagne 快速上手指南\n\nLasagne 是一个基于 Theano 的轻量级神经网络库，专为构建和训练深度学习模型而设计。它支持卷积神经网络（CNN）、循环神经网络（RNN\u002FLSTM）及其组合，具有代码简洁、透明度高和模块化强等特点。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**：Linux, macOS 或 Windows (需配置相应 Python 环境)\n*   **Python 版本**：推荐 Python 3.6+\n*   **核心依赖**：\n    *   **Theano**：Lasagne 的后端计算引擎（注意：Theano 已停止官方维护，建议使用兼容版本或社区维护版如 `theano-pymc`）。\n    *   **NumPy** & **SciPy**：科学计算基础库。\n*   **硬件加速（可选）**：若需使用 GPU 加速，请预先安装好 CUDA 和 cuDNN，并确保 Theano 已正确配置为 GPU 模式。\n\n## 安装步骤\n\n您可以使用 `pip` 一键安装兼容版本的 Theano 依赖及最新的 Lasagne 开发版。\n\n**国内加速建议**：\n为了提高下载速度，建议在使用 `pip` 时指定国内镜像源（如清华源或阿里源）。\n\n```bash\n# 1. 安装依赖 (使用清华镜像加速)\npip install -r https:\u002F\u002Fraw.githubusercontent.com\u002FLasagne\u002FLasagne\u002Fmaster\u002Frequirements.txt -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n\n# 2. 安装最新版 Lasagne (使用清华镜像加速)\npip install https:\u002F\u002Fgithub.com\u002FLasagne\u002FLasagne\u002Farchive\u002Fmaster.zip -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n> **注意**：如果上述命令中自动安装的 Theano 版本与您本地的 GPU 环境不兼容，请先手动卸载 Theano，然后根据您的硬件环境单独安装特定版本的 Theano，再执行第二步安装 Lasagne。\n\n## 基本使用\n\n以下是一个最简示例，展示如何构建一个简单的卷积神经网络（CNN），定义损失函数并进行训练。\n\n```python\nimport lasagne\nimport theano\nimport theano.tensor as T\n\n# 1. 创建 Theano 变量用于输入和目标小批量数据\ninput_var = T.tensor4('X')\ntarget_var = T.ivector('y')\n\n# 2. 构建一个简单的卷积神经网络\nfrom lasagne.nonlinearities import leaky_rectify, softmax\n\n# 输入层：假设输入为 (批次大小，3 通道，32x32 图像)\nnetwork = lasagne.layers.InputLayer((None, 3, 32, 32), input_var)\n\n# 卷积层 1\nnetwork = lasagne.layers.Conv2DLayer(network, 64, (3, 3),\n                                     nonlinearity=leaky_rectify)\n# 卷积层 2\nnetwork = lasagne.layers.Conv2DLayer(network, 32, (3, 3),\n                                     nonlinearity=leaky_rectify)\n# 池化层\nnetwork = lasagne.layers.Pool2DLayer(network, (3, 3), stride=2, mode='max')\n\n# 全连接层 (带 Dropout 和正交初始化)\nnetwork = lasagne.layers.DenseLayer(lasagne.layers.dropout(network, 0.5),\n                                    128, nonlinearity=leaky_rectify,\n                                    W=lasagne.init.Orthogonal())\n# 输出层 (10 类分类)\nnetwork = lasagne.layers.DenseLayer(lasagne.layers.dropout(network, 0.5),\n                                    10, nonlinearity=softmax)\n\n# 3. 创建损失函数\nprediction = lasagne.layers.get_output(network)\nloss = lasagne.objectives.categorical_crossentropy(prediction, target_var)\nloss = loss.mean() + 1e-4 * lasagne.regularization.regularize_network_params(\n        network, lasagne.regularization.l2)\n\n# 4. 创建参数更新表达式 (使用 Nesterov 动量优化器)\nparams = lasagne.layers.get_all_params(network, trainable=True)\nupdates = lasagne.updates.nesterov_momentum(loss, params, learning_rate=0.01,\n                                            momentum=0.9)\n\n# 5. 编译训练函数\ntrain_fn = theano.function([input_var, target_var], loss, updates=updates)\n\n# 6. 模拟训练循环 (假设 training_data 是包含 numpy 数组的迭代器)\n# for epoch in range(100):\n#     loss = 0\n#     for input_batch, target_batch in training_data:\n#         loss += train_fn(input_batch, target_batch)\n#     print(\"Epoch %d: Loss %g\" % (epoch + 1, loss \u002F len(training_data)))\n\n# 7. 创建预测函数 (确定性模式，关闭 Dropout)\ntest_prediction = lasagne.layers.get_output(network, deterministic=True)\npredict_fn = theano.function([input_var], T.argmax(test_prediction, axis=1))\n\n# print(\"Predicted class for first test input: %r\" % predict_fn(test_data[0]))\n```\n\n更多完整示例（如 MNIST 实战）请参考官方仓库中的 `examples\u002Fmnist.py` 文件或访问在线教程。","某计算机视觉研究团队正在基于 Theano 框架开发一个用于识别工业零件缺陷的卷积神经网络（CNN），需要在有限时间内验证多种网络架构的有效性。\n\n### 没有 Lasagne 时\n- **代码冗余严重**：研究人员需手动编写大量底层 Theano 符号表达式来定义卷积、池化及全连接层，导致核心算法逻辑被繁琐的矩阵运算淹没。\n- **梯度推导困难**：每次尝试新的损失函数或正则化策略时，都必须人工推导并硬编码梯度公式，极易出错且调试成本极高。\n- **架构迭代缓慢**：想要测试“多输入辅助分类器”或切换 LSTM 单元等复杂结构时，需要重构大量样板代码，严重拖慢实验进度。\n- **硬件适配复杂**：为了让模型在 GPU 上运行，往往需要额外编写设备迁移逻辑，无法透明地利用 Theano 的编译优化能力。\n\n### 使用 Lasagne 后\n- **构建简洁直观**：通过 `Conv2DLayer`、`DenseLayer` 等模块化组件，仅需数行代码即可像搭积木一样堆叠出复杂的 CNN 架构，代码可读性大幅提升。\n- **自动微分解放人力**：依托 Theano 的符号微分特性，Lasagne 自动处理梯度计算，研究人员可自由定义任意代价函数而无需关心反向传播细节。\n- **灵活扩展架构**：轻松实现多输出分支、Dropout 正则化及正交初始化等高级特性，快速验证不同超参数组合对缺陷识别率的影响。\n- **透明硬件加速**：代码无需修改即可在 CPU 与 GPU 间无缝切换，直接享受底层编译器带来的算力加速，专注于模型效果而非工程配置。\n\nLasagne 通过将底层数学细节封装为直观的模块化接口，让研究人员能从繁琐的代码实现中解脱，真正聚焦于神经网络架构的创新与优化。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FLasagne_Lasagne_0e05dded.png","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FLasagne_311a8f8a.png","",null,"https:\u002F\u002Fgithub.com\u002FLasagne",[77],{"name":78,"color":79,"percentage":80},"Python","#3572A5",100,3866,937,"2026-04-15T05:27:32","NOASSERTION",4,"未说明","非必需（透明支持 CPU 和 GPU），具体型号、显存及 CUDA 版本取决于后端 Theano 的配置，文中未明确指定",{"notes":89,"python":86,"dependencies":90},"Lasagne 是一个基于 Theano 的轻量级神经网络库，并非独立运行，必须安装兼容版本的 Theano 才能使用。由于 Theano 项目已停止维护，现代环境安装可能较为困难。该库支持前馈网络（如 CNN）、循环网络（如 LSTM）及其组合，并通过 Theano 的符号微分自动计算梯度，无需手动推导。",[91,92],"Theano","NumPy",[14],[95,96,97,98],"deep-learning-library","neural-networks","python","theano","2026-03-27T02:49:30.150509","2026-04-16T15:52:19.179752",[102,107,112,117,121,126],{"id":103,"question_zh":104,"answer_zh":105,"source_url":106},36039,"如何在 Siamese（孪生）或 Triplet（三元组）网络中正确使用批归一化（Batch Normalization）层，以确保多通道共享相同的统计值？","实现 Siamese 网络最高效的方法是将批次大小加倍（将输入左右分支的样本拼接），然后在网络头部使用 SliceLayer 分割或使用 ReshapeLayer 重塑张量。这样，BN 层会同时利用所有输入进行归一化，从而共享均值和方差。如果无法这样做，唯一的替代方案是编写一个自定义的 BN 层，使其能够接受并归一化多个输入。","https:\u002F\u002Fgithub.com\u002FLasagne\u002FLasagne\u002Fissues\u002F141",{"id":108,"question_zh":109,"answer_zh":110,"source_url":111},36040,"在具有有向无环图（DAG）结构的网络中（即多个层共享同一个输入层），为什么输出会被重复计算，这会导致什么问题？","Lasagne 通过递归调用父层的 get_output() 来计算输出。在 DAG 结构中，这会导致共享输入层的输出表达式被多次构建。虽然 Theano 通常能优化掉重复的计算，但在两种情况下会失败：1. 使用 scan 操作时，Theano 不会合并它们的梯度；2. 当层输出具有非确定性（如 Dropout）时，每次调用都会重新采样随机变量，导致 Theano 无法合并子表达式。解决方案是确保每个层的 get_output() 只被调用一次，例如通过记忆化（memoization）技术。","https:\u002F\u002Fgithub.com\u002FLasagne\u002FLasagne\u002Fissues\u002F104",{"id":113,"question_zh":114,"answer_zh":115,"source_url":116},36041,"如何在 LSTM 层或循环层（RecurrentLayer）中添加 Dropout？","对于标准的循环层，可以在任何 Lasagne 循环层之前添加一个 Dropout 层来达到类似效果。如果需要更精细的控制（例如对 LSTM 内部的特定连接添加 Dropout），则需要使用“可定制”的实现方式：实例化一个自定义的 LSTM 层，用户在初始化连接时手动添加 Dropout 层。目前的计划是提供两类实现：一类是标准的密集连接实现，另一类是允许用户自定义所有连接的实现。","https:\u002F\u002Fgithub.com\u002FLasagne\u002FLasagne\u002Fissues\u002F17",{"id":118,"question_zh":119,"answer_zh":120,"source_url":106},36042,"如何在训练过程中实现批归一化（BN）的移动平均（Moving Average）以用于推理阶段？","可以针对每个 mini-batch 更新共享变量 mean 和 std。具体逻辑为：*mean = (1-e) * mean + e * map.mean() 以及 *std = (1-e) * std + e * map.std()。其中 e 是动量系数（例如设为 0.01），在训练结束时 e 应接近 0。这种方法仅推断最后的均值和标准差，可以有效节省内存，且已在包含卷积和 MLP 的网络中验证有效。",{"id":122,"question_zh":123,"answer_zh":124,"source_url":125},36043,"如何为那些依赖 GPU 才能导入的子模块（如 corrmm, cuda_convnet, dnn）生成文档？","这些子模块在没有 GPU 的环境中无法导入，因此需要特殊处理才能在 ReadTheDocs 等平台上显示文档。这通常涉及配置文档构建环境以包含 GPU 支持，或者在文档生成脚本中添加模拟\u002F存根（stub）以便在无 GPU 环境下导入模块结构。这是一个已知待办事项，需专门解决以使文档正常显示。","https:\u002F\u002Fgithub.com\u002FLasagne\u002FLasagne\u002Fissues\u002F203",{"id":127,"question_zh":128,"answer_zh":129,"source_url":116},36044,"为什么在初始化 LSTMLayer 时设置 dropout_rate=0 会报错？","这通常是因为用户试图在默认的标准 LSTMLayer 类中直接传递 dropout_rate 参数，而该类可能尚未原生支持此参数的直接初始化（或者参数名\u002F用法有误）。如果需要控制 Dropout，建议在 LSTM 层之前单独添加一个 Dropout 层，或者使用允许自定义连接的“可定制”LSTM 实现来手动管理 Dropout。",[131],{"id":132,"version":133,"summary_zh":134,"released_at":135},288839,"v0.1","- 核心贡献者（按字母顺序）：\n  - Eric Battenberg (@ebattenberg)\n  - Sander Dieleman (@benanne)\n  - Daniel Nouri (@dnouri)\n  - Eben Olson (@ebenolson)\n  - Aäron van den Oord (@avdnoord)\n  - Colin Raffel (@craffel)\n  - Jan Schlüter (@f0k)\n  - Søren Kaae Sønderby (@skaae)\n- 额外贡献者（按时间顺序）：\n  - Daniel Maturana (@dimatura)：文档、cuDNN 层、LRN\n  - Jonas Degrave (@317070)：修复 get_all_param_values()\n  - Jack Kelly (@JackKelly)：协助处理循环层\n  - Gábor Takács (@takacsg84)：在 lasagne.updates 中支持可广播参数\n  - Diogo Moitinho de Almeida (@diogo149)：修复 MNIST 示例\n  - Brian McFee (@bmcfee)：修复 MaxPool2DLayer\n  - Martin Thoma (@MartinThoma)：文档\n  - Jeffrey De Fauw (@JeffreyDF)：文档、修复 ADAM 算法\n  - Michael Heilman (@mheilman)：NonlinearityLayer、lasagne.random\n  - Gregory Sanders (@instagibbs)：修复文档\n  - Jon Crall (@erotemic)：检查输入形状是否为非正数\n  - Hendrik Weideman (@hjweide)：set_all_param_values() 测试、修复 MaxPool2DCCLayer\n  - Kashif Rasul (@kashif)：简化 ADAM 算法\n  - Peter de Rivaz (@peterderivaz)：修复文档\n","2015-08-13T21:00:09"]