[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-MrGemy95--Tensorflow-Project-Template":3,"tool-MrGemy95--Tensorflow-Project-Template":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},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,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},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 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":79,"owner_location":80,"owner_email":81,"owner_twitter":82,"owner_website":83,"owner_url":84,"languages":85,"stars":90,"forks":91,"last_commit_at":92,"license":93,"difficulty_score":23,"env_os":94,"env_gpu":95,"env_ram":94,"env_deps":96,"category_tags":101,"github_topics":102,"view_count":23,"oss_zip_url":113,"oss_zip_packed_at":113,"status":16,"created_at":114,"updated_at":115,"faqs":116,"releases":167},1366,"MrGemy95\u002FTensorflow-Project-Template","Tensorflow-Project-Template","A best practice for tensorflow project template architecture. ","Tensorflow-Project-Template 是一份为 TensorFlow 项目量身定制的“脚手架”。它把每次新建深度学习项目都要重复写的代码——模型定义、训练循环、数据读取、日志记录、配置管理——统统封装成清晰可扩展的模板。开发者只需继承几个基类，填入自己的网络结构和训练逻辑，就能立刻跑通实验，省去大量样板代码。\n\n它解决了“项目起步慢、目录混乱、代码难复用”的痛点，让团队内部或跨项目之间保持一致的工程规范。尤其适合需要频繁迭代模型的算法工程师、科研人员，以及希望把研究快速落地的学生。模板采用面向对象设计，模型、训练器、数据加载器、日志器各司其职，配合 YAML 配置一键切换超参数；还内置 TensorBoard 日志与断点续训，方便调试与结果追踪。","# Tensorflow Project Template\nA simple and well designed structure is essential for any Deep Learning project, so after a lot of practice and contributing in tensorflow projects here's a tensorflow project template that combines   **simplcity**, **best practice for folder structure** and **good OOP design**.\nThe main idea is that there's much stuff you do every time you start your tensorflow project, so wrapping all this shared stuff will help you to change just the core idea every time you start a new tensorflow project.\n\n**So, here's a simple tensorflow template that help you get into your main project faster and just focus on your core (Model, Training, ...etc)**\n# Table Of Contents\n\n-  [In a Nutshell](#in-a-nutshell)\n-  [In Details](#in-details)\n    -  [Project architecture](#project-architecture)\n    -  [Folder structure](#folder-structure)\n    -  [ Main Components](#main-components)\n        -  [Models](#models)\n        -  [Trainer](#trainer)\n        -  [Data Loader](#data-loader)\n        -  [Logger](#logger)\n        -  [Configuration](#configuration)\n        -  [Main](#main)\n -  [Future Work](#future-work)\n -  [Contributing](#contributing)\n -  [Acknowledgments](#acknowledgments)\n\n# In a Nutshell   \nIn a nutshell here's how to use this template, so **for example** assume you want to implement VGG model so you should do the following:\n-  In models folder create a class named VGG that inherit the \"base_model\" class\n\n```python\n\n    class VGGModel(BaseModel):\n        def __init__(self, config):\n            super(VGGModel, self).__init__(config)\n            #call the build_model and init_saver functions.\n            self.build_model() \n            self.init_saver() \n  ```\n- Override these two functions \"build_model\" where you implement the vgg model, and \"init_saver\" where you define a tensorflow saver, then call them in the initalizer.\n    \n```python\n     def build_model(self):\n        # here you build the tensorflow graph of any model you want and also define the loss.\n        pass\n            \n     def init_saver(self):\n        # here you initalize the tensorflow saver that will be used in saving the checkpoints.\n        self.saver = tf.train.Saver(max_to_keep=self.config.max_to_keep)\n\n  ```\n   \n- In trainers folder create a VGG trainer that inherit from \"base_train\" class\n```python\n\n    class VGGTrainer(BaseTrain):\n        def __init__(self, sess, model, data, config, logger):\n            super(VGGTrainer, self).__init__(sess, model, data, config, logger)\n```\n- Override these two functions \"train_step\", \"train_epoch\" where you write the logic of the training process\n```python\n\n    def train_epoch(self):\n        \"\"\"\n       implement the logic of epoch:\n       -loop on the number of iterations in the config and call the train step\n       -add any summaries you want using the summary\n        \"\"\"\n        pass\n\n    def train_step(self):\n        \"\"\"\n       implement the logic of the train step\n       - run the tensorflow session\n       - return any metrics you need to summarize\n       \"\"\"\n        pass\n\n```\n- In main file, you create the session and instances of the following objects \"Model\", \"Logger\", \"Data_Generator\", \"Trainer\", and config\n```python\n    sess = tf.Session()\n    # create instance of the model you want\n    model = VGGModel(config)\n    # create your data generator\n    data = DataGenerator(config)\n    # create tensorboard logger\n    logger = Logger(sess, config)\n```\n- Pass the all these objects to the trainer object, and start your training by calling \"trainer.train()\" \n```python\n    trainer = VGGTrainer(sess, model, data, config, logger)\n\n    # here you train your model\n    trainer.train()\n\n```\n**You will find a template file and a simple example in the model and trainer folder that shows you how to try your first model simply.**\n\n\n# In Details\n\nProject architecture \n--------------\n\n\u003Cdiv align=\"center\">\n\n\u003Cimg align=\"center\" hight=\"600\" width=\"600\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FMrGemy95_Tensorflow-Project-Template_readme_6464eabc8350.png\">\n\n\u003C\u002Fdiv>\n\n\nFolder structure\n--------------\n\n```\n├──  base\n│   ├── base_model.py   - this file contains the abstract class of the model.\n│   └── base_train.py   - this file contains the abstract class of the trainer.\n│\n│\n├── model               - this folder contains any model of your project.\n│   └── example_model.py\n│\n│\n├── trainer             - this folder contains trainers of your project.\n│   └── example_trainer.py\n│   \n├──  mains              - here's the main(s) of your project (you may need more than one main).\n│    └── example_main.py  - here's an example of main that is responsible for the whole pipeline.\n\n│  \n├──  data _loader  \n│    └── data_generator.py  - here's the data_generator that is responsible for all data handling.\n│ \n└── utils\n     ├── logger.py\n     └── any_other_utils_you_need\n\n```\n\n\n## Main Components\n\n### Models\n--------------\n- #### **Base model**\n    \n    Base model is an abstract class that must be Inherited by any model you create, the idea behind this is that there's much shared stuff between all models.\n    The base model contains:\n    - ***Save*** -This function to save a checkpoint to the desk. \n    - ***Load*** -This function to load a checkpoint from the desk.\n    - ***Cur_epoch, Global_step counters*** -These variables to keep track of the current epoch and global step.\n    - ***Init_Saver*** An abstract function to initialize the saver used for saving and loading the checkpoint, ***Note***: override this function in the model you want to implement.\n    - ***Build_model*** Here's an abstract function to define the model, ***Note***: override this function in the model you want to implement.\n- #### **Your model**\n    Here's where you implement your model.\n    So you should :\n    - Create your model class and inherit the base_model class\n    - override \"build_model\" where you write the tensorflow model you want\n    - override \"init_save\" where you create a tensorflow saver to use it to save and load checkpoint\n    - call the \"build_model\" and \"init_saver\" in the initializer.\n\n### Trainer\n--------------\n- #### **Base trainer**\n    Base trainer is an abstract class that just wrap the training process.\n    \n- #### **Your trainer**\n     Here's what you should implement in your trainer.\n    1. Create your trainer class and inherit the base_trainer class.\n    2. override these two functions \"train_step\", \"train_epoch\" where you implement the training process of each step and each epoch.\n### Data Loader\nThis class is responsible for all data handling and processing and provide an easy interface that can be used by the trainer.\n### Logger\nThis class is responsible for the tensorboard summary, in your trainer create a dictionary of all tensorflow variables you want to summarize then pass this dictionary to logger.summarize().\n\n\nThis class also supports reporting to **Comet.ml** which allows you to see all your hyper-params, metrics, graphs, dependencies and more including real-time metric.\nAdd your API key [in the configuration file](configs\u002Fexample.json#L9):\n\nFor example: \"comet_api_key\": \"your key here\"\n\n\n### Comet.ml Integration\nThis template also supports reporting to Comet.ml which allows you to see all your hyper-params, metrics, graphs, dependencies and more including real-time metric. \n\nAdd your API key [in the configuration file](configs\u002Fexample.json#L9):\n\n\nFor example:  `\"comet_api_key\": \"your key here\"` \n\nHere's how it looks after you start training:\n\u003Cdiv align=\"center\">\n\n\u003Cimg align=\"center\" width=\"800\" src=\"https:\u002F\u002Fcomet-ml.nyc3.digitaloceanspaces.com\u002FCometDemo.gif\">\n\n\u003C\u002Fdiv>\n\nYou can also link your Github repository to your comet.ml project for full version control. \n[Here's a live page showing the example from this repo](https:\u002F\u002Fwww.comet.ml\u002Fgidim\u002Ftensorflow-project-template\u002Fcaba580d8d1547ccaed982693a645507\u002Fchart)\n\n\n\n### Configuration\nI use Json as configuration method and then parse it, so write all configs you want then parse it using \"utils\u002Fconfig\u002Fprocess_config\" and pass this configuration object to all other objects.\n### Main\nHere's where you combine all previous part.\n1. Parse the config file.\n2. Create a tensorflow session.\n2. Create an instance of \"Model\", \"Data_Generator\" and \"Logger\" and parse the config to all of them.\n3. Create an instance of \"Trainer\" and pass all previous objects to it.\n4. Now you can train your model by calling \"Trainer.train()\"\n\n\n# Future Work\n- Replace the data loader part with new tensorflow dataset API.\n\n\n# Contributing\nAny kind of enhancement or contribution is welcomed.\n\n\n# Acknowledgments\nThanks for my colleague  [Mo'men Abdelrazek](https:\u002F\u002Fgithub.com\u002Fmoemen95) for contributing in this work.\nand thanks for [Mohamed Zahran](https:\u002F\u002Fgithub.com\u002Fmoh3th1) for the review.\n**Thanks for Jtoy for including the repo in  [Awesome Tensorflow](https:\u002F\u002Fgithub.com\u002Fjtoy\u002Fawesome-tensorflow).** \n","# TensorFlow 项目模板\n对于任何深度学习项目而言，简洁且设计精良的结构都至关重要。经过大量实践并积极参与 TensorFlow 项目的开发，我们在此推出了一套 TensorFlow 项目模板，它融合了**简洁性**、**文件夹结构的最佳实践**以及**良好的面向对象设计**。\n其核心理念在于：每次启动 TensorFlow 项目时，你都会执行许多重复性的操作。通过将这些共用代码封装起来，每次启动新项目时，你只需专注于核心思想的调整即可。\n\n**因此，这里提供了一个简单的 TensorFlow 模板，帮助你更快地进入主项目，并将精力集中在核心模块上（如模型、训练等）。**\n# 目录\n\n- [概要](#in-a-nutshell)\n- [详细说明](#in-details)\n    - [项目架构](#project-architecture)\n    - [文件夹结构](#folder-structure)\n    - [主要组件](#main-components)\n        - [模型](#models)\n        - [训练器](#trainer)\n        - [数据加载器](#data-loader)\n        - [日志记录器](#logger)\n        - [配置](#configuration)\n        - [主程序](#main)\n - [未来工作](#future-work)\n - [贡献者](#contributing)\n - [致谢](#acknowledgments)\n\n# 概要  \n简而言之，使用此模板的方式如下：例如，如果你想实现 VGG 模型，可以按照以下步骤操作：\n- 在 `models` 文件夹中创建一个名为 `VGG` 的类，并将其继承自 `base_model` 类。\n\n```python\nclass VGGModel(BaseModel):\n    def __init__(self, config):\n        super(VGGModel, self).__init__(config)\n        # 调用 build_model 和 init_saver 函数\n        self.build_model()\n        self.init_saver()\n```\n- 重写这两个函数：`build_model` 用于实现 VGG 模型，`init_saver` 用于定义 TensorFlow Saver，然后在初始化器中调用它们。\n\n```python\ndef build_model(self):\n    # 在此处构建任意模型所需的 TensorFlow 图，同时定义损失函数\n    pass\n\ndef init_saver(self):\n    # 在此处初始化 TensorFlow Saver，用于保存和加载检查点\n    self.saver = tf.train.Saver(max_to_keep=self.config.max_to_keep)\n```\n- 在 `trainers` 文件夹中创建一个继承自 `base_train` 类的 VGG 训练器。\n\n```python\nclass VGGTrainer(BaseTrain):\n    def __init__(self, sess, model, data, config, logger):\n        super(VGGTrainer, self).__init__(sess, model, data, config, logger)\n```\n- 重写两个函数：`train_step` 和 `train_epoch`，用于编写训练过程的逻辑。\n\n```python\ndef train_epoch(self):\n    \"\"\"\n    实现每个 epoch 的逻辑：\n    - 遍历配置中的迭代次数，调用 train_step 方法\n    - 使用 summary 添加所需的各种摘要信息\n    \"\"\"\n    pass\n\ndef train_step(self):\n    \"\"\"\n    实现训练步的逻辑：\n    - 运行 TensorFlow 会话\n    - 返回需要汇总的各类指标\n    \"\"\"\n    pass\n```\n- 在主程序文件中，创建会话，并实例化以下对象：“Model”、“Logger”、“Data_Generator”、“Trainer”以及配置。\n\n```python\nsess = tf.Session()\n# 创建所需模型的实例\nmodel = VGGModel(config)\n# 创建数据生成器\ndata = DataGenerator(config)\n# 创建 TensorBoard 日志记录器\nlogger = Logger(sess, config)\n```\n- 将上述所有对象传递给训练器对象，并通过调用 `trainer.train()` 启动训练过程。\n\n```python\ntrainer = VGGTrainer(sess, model, data, config, logger)\n\n# 在此处开始训练你的模型\ntrainer.train()\n```\n\n**在 `model` 和 `trainer` 文件夹中，你将找到一个模板文件和一个简单的示例，展示如何轻松试用你的第一个模型。**\n\n# 详细说明\n\n项目架构 \n--------------\n\n\u003Cdiv align=\"center\">\n\n\u003Cimg align=\"center\" hight=\"600\" width=\"600\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FMrGemy95_Tensorflow-Project-Template_readme_6464eabc8350.png\">\n\n\u003C\u002Fdiv>\n\n\n文件夹结构\n--------------\n\n```\n├── base\n│   ├── base_model.py   - 该文件包含模型的抽象类。\n│   └── base_train.py   - 该文件包含训练器的抽象类。\n│\n│\n├── model               - 该文件夹包含项目中的任意模型。\n│   └── example_model.py\n│\n│\n├── trainer             - 该文件夹包含项目的训练器。\n│   └── example_trainer.py\n│   \n├── mains              - 这里是项目的主程序（你可能需要多个主程序）。\n│    └── example_main.py  - 这里有一个主程序示例，负责整个流水线的运行。\n│\n├── data_loader  \n│    └── data_generator.py  - 这里是数据生成器，负责所有的数据处理。\n│ \n└── utils\n     ├── logger.py\n     └── 其他你需要的工具\n\n```\n\n\n## 主要组件\n\n### 模型\n--------------\n- #### **基础模型**\n    \n    基础模型是一个抽象类，任何你创建的模型都必须继承自它。其核心理念在于：所有模型之间存在大量共用代码。\n    基础模型包含以下功能：\n    - ***保存*** - 该函数用于将检查点保存到本地磁盘。\n    - ***加载*** - 该函数用于从本地磁盘加载检查点。\n    - ***当前 epoch 和全局步数计数器*** - 这些变量用于记录当前的 epoch 和全局步数。\n    - ***Init_Saver*** 是一个抽象函数，用于初始化用于保存和加载检查点的 Saver；**注意**：请在你想要实现的模型中重写该函数。\n    - ***Build_model*** 是一个抽象函数，用于定义模型；**注意**：请在你想要实现的模型中重写该函数。\n- #### **你的模型**\n    这里是你实现自己模型的地方。\n    因此，你应该：\n    - 创建自己的模型类，并继承 `base_model` 类。\n    - 重写 `build_model` 函数，用于编写你想要的 TensorFlow 模型。\n    - 重写 `init_saver` 函数，用于创建 TensorFlow Saver，以便于保存和加载检查点。\n    - 在初始化器中调用 `build_model` 和 `init_saver`。\n\n### 训练器\n--------------\n- #### **基础训练器**\n    基础训练器是一个抽象类，仅用于封装训练流程。\n- #### **你的训练器**\n    这里是你应该在训练器中实现的内容：\n    1. 创建自己的训练器类，并继承 `base_trainer` 类。\n    2. 重写 `train_step` 和 `train_epoch` 这两个函数，分别实现每一步和每个 epoch 的训练过程。\n### 数据加载器\n该类负责所有的数据处理与加工，并提供了一个易于使用的接口，供训练器调用。\n\n### 日志记录器\n该类负责生成 TensorBoard 摘要。在训练器中，您需要创建一个包含所有希望进行摘要的 TensorFlow 变量的字典，并将此字典传递给 `logger.summarize()` 方法。\n\n此外，该类还支持向 **Comet.ml** 进行报告，使您能够查看所有的超参数、指标、图表、依赖关系等信息，包括实时指标。\n在配置文件中添加您的 API 密钥[（在配置文件中）](configs\u002Fexample.json#L9)：\n\n例如：“comet_api_key”: “您的密钥在此处”\n\n### Comet.ml 集成\n本模板同样支持向 Comet.ml 进行报告，让您能够查看所有的超参数、指标、图表、依赖关系等信息，包括实时指标。\n\n在配置文件中添加您的 API 密钥[（在配置文件中）](configs\u002Fexample.json#L9)：\n\n例如：“comet_api_key”: “您的密钥在此处”\n\n以下是开始训练后显示的效果：\n\u003Cdiv align=\"center\">\n\n\u003Cimg align=\"center\" width=\"800\" src=\"https:\u002F\u002Fcomet-ml.nyc3.digitaloceanspaces.com\u002FCometDemo.gif\">\n\n\u003C\u002Fdiv>\n\n您还可以将 GitHub 仓库链接至您的 Comet.ml 项目，以实现完整的版本控制功能。\n[这里有一个实时页面，展示了来自该仓库的示例](https:\u002F\u002Fwww.comet.ml\u002Fgidim\u002Ftensorflow-project-template\u002Fcaba580d8d1547ccaed982693a645507\u002Fchart)\n\n### 配置\n我采用 JSON 作为配置方式，并对其进行解析。因此，您可以编写所有所需的配置，然后使用“utils\u002Fconfig\u002Fprocess_config”对配置进行解析，并将该配置对象传递给所有其他对象。\n### 主要部分\n此处是您将之前各部分整合在一起的地方。\n1. 解析配置文件。\n2. 创建 TensorFlow 会话。\n3. 创建“Model”、“Data_Generator”和“Logger”的实例，并将配置解析并应用到这些实例中。\n4. 创建“Trainer”的实例，并将所有先前的对象传递给它。\n5. 现在，您可以通过调用“Trainer.train()”来训练您的模型。\n\n# 未来工作\n- 使用新的 TensorFlow 数据集 API 替换数据加载器部分。\n\n# 贡献\n我们欢迎任何形式的改进与贡献。\n\n# 感谢\n感谢我的同事 [Mo'men Abdelrazek](https:\u002F\u002Fgithub.com\u002Fmoemen95) 在这项工作中所作出的贡献。\n同时，也感谢 [Mohamed Zahran](https:\u002F\u002Fgithub.com\u002Fmoh3th1) 的审阅工作。\n\n**感谢 Jtoy 将该仓库纳入 [Awesome Tensorflow](https:\u002F\u002Fgithub.com\u002Fjtoy\u002Fawesome-tensorflow) 中。**","# Tensorflow-Project-Template 快速上手指南\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**: Linux, macOS 或 Windows\n*   **Python**: 建议 Python 3.6+ (取决于您安装的 TensorFlow 版本)\n*   **核心依赖**:\n    *   `tensorflow` (本模板主要基于 TF 1.x 风格设计，若使用 TF 2.x 请注意兼容性或启用兼容模式)\n    *   `json` (Python 内置，用于配置解析)\n    *   `comet_ml` (可选，用于实验追踪)\n\n安装前置依赖：\n\n```bash\npip install tensorflow\npip install comet_ml\n```\n\n> **提示**：国内用户可使用清华源加速安装：\n> `pip install tensorflow comet_ml -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple`\n\n## 安装步骤\n\n本项目是一个项目模板，无需通过 pip 安装。请直接克隆仓库并作为您新项目的起点：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FMrgemy95\u002FTensorflow-Project-Templete.git \u003Cyour_project_name>\ncd \u003Cyour_project_name>\n```\n\n克隆后，目录结构已预置好最佳实践的文件夹架构（包含 `base`, `model`, `trainer`, `data_loader`, `utils` 等）。\n\n## 基本使用\n\n本模板的核心思想是通过继承基类来快速构建模型和训练流程。以下以实现一个 **VGG 模型** 为例，展示最简使用流程。\n\n### 1. 定义模型 (Model)\n\n在 `model\u002F` 目录下创建新文件（如 `vgg_model.py`），继承 `BaseModel` 并重写构建逻辑：\n\n```python\nfrom base.base_model import BaseModel\nimport tensorflow as tf\n\nclass VGGModel(BaseModel):\n    def __init__(self, config):\n        super(VGGModel, self).__init__(config)\n        # 调用构建模型和初始化保存器的函数\n        self.build_model() \n        self.init_saver() \n\n    def build_model(self):\n        # 在此处构建您的 TensorFlow 计算图并定义损失函数\n        # 示例占位符：\n        # self.prediction = ...\n        # self.loss = ...\n        pass\n            \n    def init_saver(self):\n        # 初始化用于保存检查点的 TensorFlow Saver\n        self.saver = tf.train.Saver(max_to_keep=self.config.max_to_keep)\n```\n\n### 2. 定义训练器 (Trainer)\n\n在 `trainer\u002F` 目录下创建新文件（如 `vgg_trainer.py`），继承 `BaseTrain` 并重写训练步骤：\n\n```python\nfrom base.base_train import BaseTrain\n\nclass VGGTrainer(BaseTrain):\n    def __init__(self, sess, model, data, config, logger):\n        super(VGGTrainer, self).__init__(sess, model, data, config, logger)\n\n    def train_epoch(self):\n        \"\"\"\n        实现每个 epoch 的逻辑:\n        - 循环执行配置中的迭代次数并调用 train_step\n        - 添加需要的 summaries\n        \"\"\"\n        pass\n\n    def train_step(self):\n        \"\"\"\n        实现单个训练步的逻辑:\n        - 运行 TensorFlow session\n        - 返回需要记录的 metrics\n        \"\"\"\n        pass\n```\n\n### 3. 编写主程序 (Main)\n\n在 `mains\u002F` 目录下修改或新建入口文件，组装所有组件并启动训练：\n\n```python\nimport tensorflow as tf\nfrom utils.process_config import process_config\nfrom model.vgg_model import VGGModel\nfrom trainer.vgg_trainer import VGGTrainer\nfrom data_loader.data_generator import DataGenerator\nfrom utils.logger import Logger\n\n# 1. 解析配置文件\nconfig = process_config('configs\u002Fexample.json')\n\n# 2. 创建 TensorFlow Session\nsess = tf.Session()\n\n# 3. 实例化各组件\nmodel = VGGModel(config)\ndata = DataGenerator(config)\nlogger = Logger(sess, config)\n\n# 4. 创建训练器并传入所有对象\ntrainer = VGGTrainer(sess, model, data, config, logger)\n\n# 5. 开始训练\ntrainer.train()\n```\n\n### 4. 配置与运行\n\n*   **配置文件**: 编辑 `configs\u002Fexample.json` 设置超参数、路径及日志选项。\n    *   若需使用 **Comet.ml** 进行实验可视化，请在配置文件中填入您的 API Key：\n        ```json\n        \"comet_api_key\": \"your_key_here\"\n        ```\n*   **启动**: 运行您的 main 文件即可开始训练。\n\n```bash\npython mains\u002Fexample_main.py\n```\n\n模板中的 `model\u002Fexample_model.py` 和 `trainer\u002Fexample_trainer.py` 提供了完整的参考示例，建议优先阅读这两个文件以理解具体实现细节。","某计算机视觉团队正在紧急开发一个基于 VGG 架构的工业缺陷检测系统，需要在两周内完成从原型验证到多轮迭代训练的全过程。\n\n### 没有 Tensorflow-Project-Template 时\n- **结构混乱难维护**：每位工程师按个人习惯随意创建文件夹，导致模型定义、数据加载和训练逻辑耦合严重，新人接手代码需花费数天梳理架构。\n- **重复造轮子效率低**：每次启动新实验都要重新编写会话管理、检查点保存（Saver）和 TensorBoard 日志记录等样板代码，极易出现复制粘贴错误。\n- **实验复现成本高**：缺乏统一的配置管理和面向对象封装，调整超参数或更换模型时往往牵一发而动全身，难以快速对比不同实验结果。\n- **协作沟通障碍大**：由于缺乏标准化的 `Trainer` 和 `Model` 基类接口，团队成员在合并代码时常因逻辑不一致产生冲突，调试耗时巨大。\n\n### 使用 Tensorflow-Project-Template 后\n- **架构清晰标准化**：直接沿用其最佳实践目录结构，将 VGG 模型继承自 `BaseModel`，训练逻辑封装进 `VGGTrainer`，代码模块职责分明，新人半天即可上手。\n- **核心聚焦零冗余**：只需重写 `build_model` 和 `train_step` 等关键函数，自动复用模板中成熟的会话初始化、日志记录和断点续训功能，开发效率提升 50% 以上。\n- **灵活迭代易复现**：通过统一的配置文件管理超参数，结合解耦的数据加载器与日志模块，可一键切换实验设置并完整保留训练轨迹，轻松实现结果复现。\n- **团队协作无缝衔接**：基于标准的 OOP 设计规范，成员间代码风格高度一致，合并请求审查迅速，将更多精力集中于优化算法本身而非修复工程漏洞。\n\nTensorflow-Project-Template 通过提供标准化的工程骨架，让开发者从繁琐的基础设施搭建中解放出来，真正专注于深度学习模型的核心创新。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FMrGemy95_Tensorflow-Project-Template_3a6c80e4.png","MrGemy95","Mahmoud G. Salem","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FMrGemy95_4f38ce3e.jpg","MSc. in AI at university of Guelph and Vector Institute. \r\n\r\n","University of Guelph, Vector Institute, Samsung","Toronto, Canada","mahmoud.gemy18@gmail.com","mrgemy95","https:\u002F\u002Fscholar.google.ca\u002Fcitations?user=iN5_bwUAAAAJ&hl=en","https:\u002F\u002Fgithub.com\u002FMrGemy95",[86],{"name":87,"color":88,"percentage":89},"Python","#3572A5",100,3627,798,"2026-04-02T16:16:05","Apache-2.0","未说明","未说明 (基于 TensorFlow 框架，通常建议使用 NVIDIA GPU 以加速训练，但 README 未指定具体型号、显存或 CUDA 版本)",{"notes":97,"python":94,"dependencies":98},"这是一个 TensorFlow 项目模板，旨在提供清晰的文件夹结构和面向对象设计。用户需自行实现具体的模型（继承 BaseModel）、训练逻辑（继承 BaseTrain）和数据加载器。配置通过 JSON 文件管理。支持可选的 Comet.ml 集成用于实验跟踪。README 中提到未来计划将数据加载部分替换为新的 TensorFlow Dataset API。",[99,100],"tensorflow","comet_ml (可选)",[13],[103,104,105,106,107,108,109,110,111,99,112],"tesnorflow","software-engineering","oop","deep-learning","neural-network","convolutional-neural-networks","tensorflow-tutorials","deep-learning-tutorial","best-practices","template",null,"2026-03-27T02:49:30.150509","2026-04-06T06:45:25.681419",[117,122,127,132,137,142,147,152,157,162],{"id":118,"question_zh":119,"answer_zh":120,"source_url":121},6264,"为什么要在子类中实现 `init_saver` 而不是直接在基类中使用默认实现？","因为 `tf.train.Saver` 会保存当前所有的 TensorFlow 变量。如果在构建模型之前调用它，将不会保存任何内容并导致严重错误。因此，强制要求在子类中实现该函数，以确保在模型构建完成后才初始化 Saver。","https:\u002F\u002Fgithub.com\u002FMrGemy95\u002FTensorflow-Project-Template\u002Fissues\u002F17",{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},6265,"加载模型时变量被重新初始化为默认值怎么办？","这是因为在加载模型后执行了变量初始化操作。解决方案是将 `model.load()` 的调用位置移动到创建 Trainer 实例之后（即 `trainer = ExampleTrainer(...)` 之后），或者更好的做法是将变量初始化部分从 Trainer 类中移除，直接放在 `main()` 函数中合适的位置执行。","https:\u002F\u002Fgithub.com\u002FMrGemy95\u002FTensorflow-Project-Template\u002Fissues\u002F25",{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},6266,"为什么要使用独立的 Trainer 类，而不是将训练逻辑作为方法写在 Model 类中？","这是为了模块化设计。通常在项目中需要对比多个不同的模型，如果将训练逻辑写在 Model 类中，每个模型都要重复编写训练代码。使用独立的 Trainer 类只需编写一次训练逻辑，然后可以将任何模型实例传递给它进行训练。","https:\u002F\u002Fgithub.com\u002FMrGemy95\u002FTensorflow-Project-Template\u002Fissues\u002F34",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},6267,"运行示例代码时出现 `ModuleNotFoundError: No module named 'data_loader'` 错误如何解决？","这是 Python 兄弟包（sibling package）导入路径的问题。可以通过将项目根目录添加到 `PYTHONPATH` 环境变量中来解决，或者在运行脚本前确保当前工作目录正确。参考 StackOverflow 相关讨论：https:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F6323860\u002Fsibling-package-imports","https:\u002F\u002Fgithub.com\u002FMrGemy95\u002FTensorflow-Project-Template\u002Fissues\u002F26",{"id":138,"question_zh":139,"answer_zh":140,"source_url":141},6268,"运行代码时报错 'missing or invalid parameters'，如何指定配置文件？","需要在运行命令中添加配置文件路径作为输入参数。例如：`python main.py -c test.json`。请确保 `-c` 后面跟随正确的 JSON 配置文件路径。","https:\u002F\u002Fgithub.com\u002FMrGemy95\u002FTensorflow-Project-Template\u002Fissues\u002F9",{"id":143,"question_zh":144,"answer_zh":145,"source_url":146},6269,"代码中的 `from bunch import Bunch` 是什么？Bunch 的作用是什么？","Bunch 是一个用于将字典（dictionary）转换为命名空间对象的工具库。它的主要作用是允许通过点号（`.`）操作符来访问配置项（例如 `config.key` 而不是 `config['key']`）。作者计划将其更新为 `easydict` 库，但核心目的都是为了更方便地访问配置数据。","https:\u002F\u002Fgithub.com\u002FMrGemy95\u002FTensorflow-Project-Template\u002Fissues\u002F13",{"id":148,"question_zh":149,"answer_zh":150,"source_url":151},6270,"为什么 epoch 和 step 计数要使用 TensorFlow Variables 而不是普通的 Python 变量？","使用 TensorFlow Variables 是为了在实验意外停止后能够恢复训练过程。通过将计数保存在计算图中，重新运行实验时可以加载之前的检查点，从而准确接续之前的 epoch 和 step 状态，而普通 Python 变量在程序重启后会丢失。","https:\u002F\u002Fgithub.com\u002FMrGemy95\u002FTensorflow-Project-Template\u002Fissues\u002F27",{"id":153,"question_zh":154,"answer_zh":155,"source_url":156},6271,"如何在这个模板结构中安排验证（validation）循环？","可以在 `base\u002Fbase_train.py` 文件中创建一个名为 `validate_epoch` 的函数。然后在 `train` 函数中，于 `self.train_epoch()` 调用之后调用这个新创建的验证函数。建议可以设置为每固定迭代次数（如每 1000 次）或每个 epoch 结束后执行一次。","https:\u002F\u002Fgithub.com\u002FMrGemy95\u002FTensorflow-Project-Template\u002Fissues\u002F33",{"id":158,"question_zh":159,"answer_zh":160,"source_url":161},6272,"TensorBoard 中 Graphs 页面显示为空，但 Scalars 正常，如何解决？","确保在构建完计算图（graph construction）之后，再使用 `summary filewriter`。如果在图构建完成之前就初始化了 writer，可能导致无法捕获图结构信息。","https:\u002F\u002Fgithub.com\u002FMrGemy95\u002FTensorflow-Project-Template\u002Fissues\u002F21",{"id":163,"question_zh":164,"answer_zh":165,"source_url":166},6273,"如何正确加载模型检查点？原始代码中的路径拼接是否有问题？","是的，原始代码中路径拼接可能存在冗余。正确的做法是直接使用 `tf.train.latest_checkpoint(self.config.checkpoint_dir)` 获取最新的检查点路径，而不需要手动拼接 `exp_name`（除非目录结构特殊）。维护者已确认并修改了此逻辑。","https:\u002F\u002Fgithub.com\u002FMrGemy95\u002FTensorflow-Project-Template\u002Fissues\u002F11",[]]