[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-PacktPublishing--Advanced-Deep-Learning-with-Keras":3,"tool-PacktPublishing--Advanced-Deep-Learning-with-Keras":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 真正成长为懂上",155373,2,"2026-04-14T11:34:08",[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":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":77,"owner_email":77,"owner_twitter":73,"owner_website":78,"owner_url":79,"languages":80,"stars":85,"forks":86,"last_commit_at":87,"license":88,"difficulty_score":10,"env_os":89,"env_gpu":90,"env_ram":91,"env_deps":92,"category_tags":105,"github_topics":106,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":112,"updated_at":113,"faqs":114,"releases":145},7481,"PacktPublishing\u002FAdvanced-Deep-Learning-with-Keras","Advanced-Deep-Learning-with-Keras"," Advanced Deep Learning with Keras, published by Packt","Advanced-Deep-Learning-with-Keras 是 Packt 出版社畅销书《Advanced Deep Learning with TensorFlow 2 and Keras》的配套开源代码库，旨在帮助开发者掌握前沿的深度学习技术。该项目完全基于 TensorFlow 2.0 和 Keras API 重构，提供了一套从基础到进阶的完整实战方案。\n\n它主要解决了学习者在从理论迈向复杂 AI 应用时的代码实现难题。内容不仅涵盖多层感知机、卷积神经网络（CNN）和循环神经网络（RNN）等基础架构，更深入探讨了 ResNet、DenseNet 等深层网络设计。其独特的技术亮点在于包含了无监督学习、目标检测（SSD）、语义分割（FCN\u002FPSPNet）等实用章节，并详细演示了生成对抗网络（GAN）、变分自编码器（VAE）的数据合成能力，以及深度强化学习（如 Deep Q-Learning）的核心算法实现。\n\n这套资源非常适合具备一定 Python 基础的 AI 开发者、数据科学家及研究人员使用。通过书中提供的动手项目，用户可以在配备 NVIDIA GPU 的环境中，快速复现","Advanced-Deep-Learning-with-Keras 是 Packt 出版社畅销书《Advanced Deep Learning with TensorFlow 2 and Keras》的配套开源代码库，旨在帮助开发者掌握前沿的深度学习技术。该项目完全基于 TensorFlow 2.0 和 Keras API 重构，提供了一套从基础到进阶的完整实战方案。\n\n它主要解决了学习者在从理论迈向复杂 AI 应用时的代码实现难题。内容不仅涵盖多层感知机、卷积神经网络（CNN）和循环神经网络（RNN）等基础架构，更深入探讨了 ResNet、DenseNet 等深层网络设计。其独特的技术亮点在于包含了无监督学习、目标检测（SSD）、语义分割（FCN\u002FPSPNet）等实用章节，并详细演示了生成对抗网络（GAN）、变分自编码器（VAE）的数据合成能力，以及深度强化学习（如 Deep Q-Learning）的核心算法实现。\n\n这套资源非常适合具备一定 Python 基础的 AI 开发者、数据科学家及研究人员使用。通过书中提供的动手项目，用户可以在配备 NVIDIA GPU 的环境中，快速复现并理解如何构建具有生成能力和决策能力的先进 AI 系统，从而高效地将其应用于自己的创新项目中。","\n\n\n# Advanced Deep Learning with TensorFlow 2 and Keras (Updated for 2nd Edition)\nThis is the code repository for [Advanced Deep Learning with TensorFlow 2 and Keras](https:\u002F\u002Fwww.packtpub.com\u002Fprogramming\u002Fadvanced-deep-learning-with-tensorflow-2-and-keras-second-edition), published by [Packt](https:\u002F\u002Fwww.packtpub.com\u002F?utm_source=github). It contains all the supporting project files necessary to work through the book from start to finish. \n\n**Please note that the code examples have been updated to support TensorFlow 2.0 Keras API only.**\n\n## About the Book\nAdvanced Deep Learning with TensorFlow 2 and Keras, Second Edition is a completely updated edition of the bestselling guide to the advanced deep learning techniques available today. Revised for TensorFlow 2.x, this edition introduces you to the practical side of deep learning with new chapters on unsupervised learning using mutual information, object detection (SSD), and semantic segmentation (FCN and PSPNet), further allowing you to create your own cutting-edge AI projects.\n\nUsing Keras as an open-source deep learning library, the book features hands-on projects that show you how to create more effective AI with the most up-to-date techniques.\n\nStarting with an overview of multi-layer perceptrons (MLPs), convolutional neural networks (CNNs), and recurrent neural networks (RNNs), the book then introduces more cutting-edge techniques as you explore deep neural network architectures, including ResNet and DenseNet, and how to create autoencoders. You will then learn about GANs, and how they can unlock new levels of AI performance.\n\nNext, you’ll discover how a variational autoencoder (VAE) is implemented, and how GANs and VAEs have the generative power to synthesize data that can be extremely convincing to humans. You'll also learn to implement DRL such as Deep Q-Learning and Policy Gradient Methods, which are critical to many modern results in AI.\n\n## Related Products\n* [Deep Reinforcement Learning Hands-On](https:\u002F\u002Fwww.packtpub.com\u002Fbig-data-and-business-intelligence\u002Fdeep-reinforcement-learning-hands?utm_source=github&utm_medium=repository&utm_campaign=9781788834247)\n\n* [Deep Learning with Keras](https:\u002F\u002Fwww.packtpub.com\u002Fbig-data-and-business-intelligence\u002Fdeep-learning-keras?utm_source=github&utm_medium=repository&utm_campaign=9781787128422)\n\n* [Reinforcement Learning with TensorFlow](https:\u002F\u002Fwww.packtpub.com\u002Fbig-data-and-business-intelligence\u002Freinforcement-learning-tensorflow?utm_source=github&utm_medium=repository&utm_campaign=9781788835725)\n\n## Installation\nIt is recommended to run within conda environment. Pls download Anacoda from: [Anaconda](https:\u002F\u002Fwww.anaconda.com\u002Fdistribution). To install anaconda:\n\n`sh \u003Cname-of-downloaded-Anaconda3-installer>`\n\nA machine with at least 1 NVIDIA GPU (1060 or better) is required. The code examples have been tested on 1060, 1080Ti, RTX 2080Ti, V100, RTX Quadro 8000 on Ubuntu 18.04 LTS. Below is a rough guide to install NVIDIA driver and CuDNN to enable GPU support.  \n\n`sudo add-apt-repository ppa:graphics-drivers\u002Fppa`\n\n`sudo apt update`\n \n`sudo ubuntu-drivers autoinstall`\n\n`sudo reboot`\n\n`nvidia-smi`\n\nAt the time of writing, `nvidia-smi`shows the NVIDIA driver version is 440.64 and CUDA version is 10.2.\n\n\nWe are almost there. The last set of packages must be installed as follows. Some steps might require `sudo` access.\n\n`conda create --name packt`\n\n`conda activate packt`\n\n`cd \u003Cgithub-dir>`\n\n`git clone https:\u002F\u002Fgithub.com\u002FPacktPublishing\u002FAdvanced-Deep-Learning-with-Keras`\n\n`cd Advanced-Deep-Learning-with-Keras`\n\n`pip install -r requirements.txt`\n\n`sudo apt-get install python-pydot`\n\n`sudo apt-get install ffmpeg`\n\nTest if a simple model can be trained without errors:\n\n`cd chapter1-keras-quick-tour`\n\n`python3 mlp-mnist-1.3.2.py`\n\nThe final output shows the accuracy of the trained model on MNIST test dataset is about 98.2%.\n\n### Alternative TensorFlow Installation\nIf you are having problems with CUDA libraries (ie `tf` could not load or find `libcudart.so.10.X`), TensorFlow and CUDA libraries can be installed together using conda:\n\n```\npip uninstall tensorflow-gpu\nconda install -c anaconda tensorflow-gpu\n```\n\n# [Advanced Deep Learning with TensorFlow 2 and Keras](https:\u002F\u002Famzn.to\u002F2wotTnN) code examples used in the book.\n\n## [Chapter 1 - Introduction](chapter1-keras-quick-tour)\n1. [MLP on MNIST](chapter1-keras-quick-tour\u002Fmlp-mnist-1.3.2.py)\n2. [CNN on MNIST](chapter1-keras-quick-tour\u002Fcnn-mnist-1.4.1.py)\n3. [RNN on MNIST](chapter1-keras-quick-tour\u002Frnn-mnist-1.5.1.py)\n\n## [Chapter 2 - Deep Networks](chapter2-deep-networks)\n1. [Functional API on MNIST](chapter2-deep-networks\u002Fcnn-functional-2.1.1.py)\n2. [Y-Network on MNIST](chapter2-deep-networks\u002Fcnn-y-network-2.1.2.py)\n3. [ResNet v1 and v2 on CIFAR10](chapter2-deep-networks\u002Fresnet-cifar10-2.2.1.py)\n4. [DenseNet on CIFAR10](chapter2-deep-networks\u002Fdensenet-cifar10-2.4.1.py)\n\n## [Chapter 3 - AutoEncoders](chapter3-autoencoders)\n1. [Denoising AutoEncoders](chapter3-autoencoders\u002Fdenoising-autoencoder-mnist-3.3.1.py)\n\nSample outputs for random digits:\n\n![Random Digits](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_50799d3d0dd6.png)\n\n2. [Colorization AutoEncoder](chapter3-autoencoders\u002Fcolorization-autoencoder-cifar10-3.4.1.py)\n\n\nSample outputs for random cifar10 images:\n\n![Colorized Images](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_32911f6282b8.png)\n## [Chapter 4 - Generative Adversarial Network (GAN)](chapter4-gan)\n1. [Deep Convolutional GAN (DCGAN)](chapter4-gan\u002Fdcgan-mnist-4.2.1.py)\n\n[Radford, Alec, Luke Metz, and Soumith Chintala. \"Unsupervised representation learning with deep convolutional generative adversarial networks.\" arXiv preprint arXiv:1511.06434 (2015).](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1511.06434.pdf%C3%AF%C2%BC%E2%80%B0)\n\nSample outputs for random digits:\n\n![Random Digits](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_1468b92b1f03.gif)\n\n2. [Conditional (GAN)](chapter4-gan\u002Fcgan-mnist-4.3.1.py)\n\n[Mirza, Mehdi, and Simon Osindero. \"Conditional generative adversarial nets.\" arXiv preprint arXiv:1411.1784 (2014).](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1411.1784)\n\nSample outputs for digits 0 to 9:\n\n![Zero to Nine](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_2d952b30c515.gif)\n## [Chapter 5 - Improved GAN](chapter5-improved-gan)\n1. [Wasserstein GAN (WGAN)](chapter5-improved-gan\u002Fwgan-mnist-5.1.2.py)\n\n[Arjovsky, Martin, Soumith Chintala, and Léon Bottou. \"Wasserstein GAN.\" arXiv preprint arXiv:1701.07875 (2017).](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1701.07875)\n\nSample outputs for random digits:\n\n![Random Digits](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_20725b248d1b.gif)\n\n2. [Least Squares GAN (LSGAN)](chapter5-improved-gan\u002Flsgan-mnist-5.2.1.py)\n\n[Mao, Xudong, et al. \"Least squares generative adversarial networks.\" 2017 IEEE International Conference on Computer Vision (ICCV). IEEE, 2017.](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ICCV_2017\u002Fpapers\u002FMao_Least_Squares_Generative_ICCV_2017_paper.pdf)\n\nSample outputs for random digits:\n\n![Random Digits](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_8db9884341f0.gif)\n\n3. [Auxiliary Classifier GAN (ACGAN)](chapter5-improved-gan\u002Facgan-mnist-5.3.1.py)\n\n[Odena, Augustus, Christopher Olah, and Jonathon Shlens. \"Conditional image synthesis with auxiliary classifier GANs. Proceedings of the 34th International Conference on Machine Learning, Sydney, Australia, PMLR 70, 2017.\"](http:\u002F\u002Fproceedings.mlr.press\u002Fv70\u002Fodena17a.html)\n\nSample outputs for digits 0 to 9:\n\n![Zero to Nine](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_af51ad60be78.gif)\n## [Chapter 6 - GAN with Disentangled Latent Representations](chapter6-disentangled-gan)\n1. [Information Maximizing GAN (InfoGAN)](chapter6-disentangled-gan\u002Finfogan-mnist-6.1.1.py)\n\n[Chen, Xi, et al. \"Infogan: Interpretable representation learning by information maximizing generative adversarial nets.\" \nAdvances in Neural Information Processing Systems. 2016.](http:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F6399-infogan-interpretable-representation-learning-by-information-maximizing-generative-adversarial-nets.pdf)\n\nSample outputs for digits 0 to 9:\n\n![Zero to Nine](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_87930f28c5f1.gif)\n\n2. [Stacked GAN](chapter6-disentangled-gan\u002Fstackedgan-mnist-6.2.1.py)\n\n[Huang, Xun, et al. \"Stacked generative adversarial networks.\" IEEE Conference on Computer Vision and Pattern Recognition (CVPR). Vol. 2. 2017](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_cvpr_2017\u002Fpapers\u002FHuang_Stacked_Generative_Adversarial_CVPR_2017_paper.pdf)\n\nSample outputs for digits 0 to 9:\n\n![Zero to Nine](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_ac8e3415cfbb.gif)\n\n## [Chapter 7 - Cross-Domain GAN](chapter7-cross-domain-gan)\n1. [CycleGAN](chapter7-cross-domain-gan\u002Fcyclegan-7.1.1.py)\n\n[Zhu, Jun-Yan, et al. \"Unpaired Image-to-Image Translation Using Cycle-Consistent Adversarial Networks.\" 2017 IEEE International Conference on Computer Vision (ICCV). IEEE, 2017.](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ICCV_2017\u002Fpapers\u002FZhu_Unpaired_Image-To-Image_Translation_ICCV_2017_paper.pdf)\n\nSample outputs for random cifar10 images:\n\n![Colorized Images](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_21bdcf561693.gif)\n\nSample outputs for MNIST to SVHN:\n\n![MNIST2SVHN](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_d94bafec65a2.png)\n\n## [Chapter 8 - Variational Autoencoders (VAE)](chapter8-vae)\n\n1. [VAE MLP MNIST](chapter8-vae\u002Fvae-mlp-mnist-8.1.1.py)\n2. [VAE CNN MNIST](chapter8-vae\u002Fcvae-cnn-mnist-8.2.1.py)\n3. [Conditional VAE and Beta VAE](chapter8-vae\u002Fcvae-cnn-mnist-8.2.1.py)\n\n[Kingma, Diederik P., and Max Welling. \"Auto-encoding Variational Bayes.\" arXiv preprint arXiv:1312.6114 (2013).](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1312.6114.pdf)\n\n[Sohn, Kihyuk, Honglak Lee, and Xinchen Yan. \"Learning structured output representation using deep conditional generative models.\" Advances in Neural Information Processing Systems. 2015.](http:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F5775-learning-structured-output-representation-using-deep-conditional-generative-models.pdf)\n\n[I. Higgins, L. Matthey, A. Pal, C. Burgess, X. Glorot, M. Botvinick, S. Mohamed, and A. Lerchner. β-VAE: Learning basic visual concepts with a constrained variational framework. ICLR, 2017.](https:\u002F\u002Fopenreview.net\u002Fpdf?id=Sy2fzU9gl)\n\nGenerated MNIST by navigating the latent space:\n\n![MNIST](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_dfb0c1869865.png)\n\n## [Chapter 9 - Deep Reinforcement Learning](chapter9-drl)\n\n1. [Q-Learning](chapter9-drl\u002Fq-learning-9.3.1.py)\n2. [Q-Learning on Frozen Lake Environment](chapter9-drl\u002Fq-frozenlake-9.5.1.py)\n3. [DQN and DDQN on Cartpole Environment](chapter9-drl\u002Fdqn-cartpole-9.6.1.py)\n\nMnih, Volodymyr, et al. \"Human-level control through deep reinforcement learning.\" Nature 518.7540 (2015): 529\n\nDQN on Cartpole Environment:\n\n![Cartpole](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_6acb22c37515.gif)\n\n## [Chapter 10 - Policy Gradient Methods](chapter10-policy)\n\n1. [REINFORCE, REINFORCE with Baseline, Actor-Critic, A2C](chapter10-policy\u002Fpolicygradient-car-10.1.1.py)\n\n[Sutton and Barto, Reinforcement Learning: An Introduction ](http:\u002F\u002Fincompleteideas.net\u002Fbook\u002Fbookdraft2017nov5.pdf)\n\n[Mnih, Volodymyr, et al. \"Asynchronous methods for deep reinforcement learning.\" International conference on machine learning. 2016.](http:\u002F\u002Fproceedings.mlr.press\u002Fv48\u002Fmniha16.pdf)\n\n\nPolicy Gradient on MountainCar Continuous Environment:\n\n![Car](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_04f8f486e46f.gif)\n\n\n## [Chapter 11 - Object Detection](chapter11-detection)\n\n1. [Single-Shot Detection](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1512.02325.pdf)\n\nSingle-Shot Detection on 3 Objects\n![SSD](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_354be0278768.png)\n\n## [Chapter 12 - Semantic Segmentation](chapter12-segmentation)\n\n1. [FCN](https:\u002F\u002Fwww.cv-foundation.org\u002Fopenaccess\u002Fcontent_cvpr_2015\u002Fpapers\u002FLong_Fully_Convolutional_Networks_2015_CVPR_paper.pdf)\n\n2. [PSPNet](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_cvpr_2017\u002Fpapers\u002FZhao_Pyramid_Scene_Parsing_CVPR_2017_paper.pdf)\n\nSemantic Segmentation\n\n![Semantic Segmentation](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_bc5be48610e5.png)\n\n## [Chapter 13 - Unsupervised Learning using Mutual Information](chapter13-mi-unsupervised)\n\n\n1. [Invariant Information Clustering](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ICCV_2019\u002Fpapers\u002FJi_Invariant_Information_Clustering_for_Unsupervised_Image_Classification_and_Segmentation_ICCV_2019_paper.pdf)\n\n2. [MINE: Mutual Information Estimation](http:\u002F\u002Fproceedings.mlr.press\u002Fv80\u002Fbelghazi18a\u002Fbelghazi18a.pdf)\n\n\nMINE\n![MINE](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_725cd82398c3.png)\n\n## Citation\nIf you find this work useful, please cite:\n\n```\n@book{atienza2020advanced,\n  title={Advanced Deep Learning with TensorFlow 2 and Keras: Apply DL, GANs, VAEs, deep RL, unsupervised learning, object detection and segmentation, and more},\n  author={Atienza, Rowel},\n  year={2020},\n  publisher={Packt Publishing Ltd}\n}\n```\n\n","# 使用 TensorFlow 2 和 Keras 的高级深度学习（已更新至第二版）\n这是 [使用 TensorFlow 2 和 Keras 的高级深度学习](https:\u002F\u002Fwww.packtpub.com\u002Fprogramming\u002Fadvanced-deep-learning-with-tensorflow-2-and-keras-second-edition) 一书的代码仓库，由 [Packt](https:\u002F\u002Fwww.packtpub.com\u002F?utm_source=github) 出版。其中包含了从头到尾完成本书所需的所有支持项目文件。\n\n**请注意，代码示例已更新为仅支持 TensorFlow 2.0 的 Keras API。**\n\n## 关于本书\n《使用 TensorFlow 2 和 Keras 的高级深度学习》第二版是对当前最畅销的高级深度学习技术指南的全面更新版本。针对 TensorFlow 2.x 进行了修订，本版通过新增关于利用互信息进行无监督学习、目标检测（SSD）以及语义分割（FCN 和 PSPNet）的章节，向读者介绍了深度学习的实践应用，帮助您创建属于自己的前沿人工智能项目。\n\n本书以开源深度学习库 Keras 为基础，提供了大量动手实践项目，展示如何运用最新技术构建更高效的人工智能系统。\n\n从多层感知机（MLP）、卷积神经网络（CNN）和循环神经网络（RNN）的概述开始，本书随后介绍了更为前沿的技术，包括 ResNet 和 DenseNet 等深度神经网络架构，以及自编码器的构建方法。接下来，您将学习生成对抗网络（GAN），了解其如何提升人工智能性能至全新水平。\n\n随后，您将探索变分自编码器（VAE）的实现方式，并理解 GAN 和 VAE 如何具备生成能力，能够合成对人类极具说服力的数据。此外，您还将学习实现深度强化学习，例如深度 Q 学习和策略梯度方法，这些技术是现代人工智能领域诸多突破性成果的关键所在。\n\n## 相关产品\n* [深度强化学习实战](https:\u002F\u002Fwww.packtpub.com\u002Fbig-data-and-business-intelligence\u002Fdeep-reinforcement-learning-hands?utm_source=github&utm_medium=repository&utm_campaign=9781788834247)\n\n* [使用 Keras 的深度学习](https:\u002F\u002Fwww.packtpub.com\u002Fbig-data-and-business-intelligence\u002Fdeep-learning-keras?utm_source=github&utm_medium=repository&utm_campaign=9781787128422)\n\n* [使用 TensorFlow 的强化学习](https:\u002F\u002Fwww.packtpub.com\u002Fbig-data-and-business-intelligence\u002Freinforcement-learning-tensorflow?utm_source=github&utm_medium=repository&utm_campaign=9781788835725)\n\n## 安装说明\n建议在 conda 环境中运行。请从以下链接下载 Anaconda：[Anaconda](https:\u002F\u002Fwww.anaconda.com\u002Fdistribution)。安装 Anaconda 的命令如下：\n\n`sh \u003Cname-of-downloaded-Anaconda3-installer>`\n\n需要至少配备一块 NVIDIA GPU（1060 或更高型号）的机器。代码示例已在 Ubuntu 18.04 LTS 上的 1060、1080Ti、RTX 2080Ti、V100 和 RTX Quadro 8000 上进行了测试。以下是安装 NVIDIA 驱动程序和 CuDNN 以启用 GPU 支持的大致步骤：\n\n```\nsudo add-apt-repository ppa:graphics-drivers\u002Fppa\nsudo apt update\nsudo ubuntu-drivers autoinstall\nsudo reboot\nnvidia-smi\n```\n\n截至撰写本文时，`nvidia-smi` 显示 NVIDIA 驱动程序版本为 440.64，CUDA 版本为 10.2。\n\n我们已经接近完成。最后还需要安装以下软件包，部分步骤可能需要 `sudo` 权限：\n\n```\nconda create --name packt\nconda activate packt\ncd \u003Cgithub-dir>\ngit clone https:\u002F\u002Fgithub.com\u002FPacktPublishing\u002FAdvanced-Deep-Learning-with-Keras\ncd Advanced-Deep-Learning-with-Keras\npip install -r requirements.txt\nsudo apt-get install python-pydot\nsudo apt-get install ffmpeg\n```\n\n测试是否可以成功训练一个简单模型：\n\n```\ncd chapter1-keras-quick-tour\npython3 mlp-mnist-1.3.2.py\n```\n\n最终输出显示，该模型在 MNIST 测试集上的准确率约为 98.2%。\n\n### TensorFlow 的替代安装方法\n如果您在使用 CUDA 库时遇到问题（例如 `tf` 无法加载或找不到 `libcudart.so.10.X`），可以通过 conda 一起安装 TensorFlow 和 CUDA 库：\n\n```\npip uninstall tensorflow-gpu\nconda install -c anaconda tensorflow-gpu\n```\n\n# 《使用 TensorFlow 2 和 Keras 的高级深度学习》（亚马逊链接：https:\u002F\u002Famzn.to\u002F2wotTnN）一书中使用的代码示例。\n\n## [第 1 章 - 简介](chapter1-keras-quick-tour)\n1. [MNIST 数据集上的 MLP](chapter1-keras-quick-tour\u002Fmlp-mnist-1.3.2.py)\n2. [MNIST 数据集上的 CNN](chapter1-keras-quick-tour\u002Fcnn-mnist-1.4.1.py)\n3. [MNIST 数据集上的 RNN](chapter1-keras-quick-tour\u002Frnn-mnist-1.5.1.py)\n\n## [第 2 章 - 深度网络](chapter2-deep-networks)\n1. [MNIST 数据集上的函数式 API](chapter2-deep-networks\u002Fcnn-functional-2.1.1.py)\n2. [Y 型网络在 MNIST 数据集上](chapter2-deep-networks\u002Fcnn-y-network-2.1.2.py)\n3. [CIFAR10 数据集上的 ResNet v1 和 v2](chapter2-deep-networks\u002Fresnet-cifar10-2.2.1.py)\n4. [CIFAR10 数据集上的 DenseNet](chapter2-deep-networks\u002Fdensenet-cifar10-2.4.1.py)\n\n## [第 3 章 - 自编码器](chapter3-autoencoders)\n1. [去噪自编码器](chapter3-autoencoders\u002Fdenoising-autoencoder-mnist-3.3.1.py)\n\n随机数字的示例输出：\n\n![随机数字](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_50799d3d0dd6.png)\n\n2. [色彩化自编码器](chapter3-autoencoders\u002Fcolorization-autoencoder-cifar10-3.4.1.py)\n\n随机 CIFAR10 图像的示例输出：\n\n![色彩化图像](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_32911f6282b8.png)\n## [第 4 章 - 生成对抗网络（GAN）](chapter4-gan)\n1. [深度卷积生成对抗网络（DCGAN）](chapter4-gan\u002Fdcgan-mnist-4.2.1.py)\n\n[Radford, Alec, Luke Metz 和 Soumith Chintala. “使用深度卷积生成对抗网络进行无监督表征学习。” arXiv 预印本 arXiv:1511.06434 (2015)。](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1511.06434.pdf%C3%AF%C2%BC%E2%80%B0)\n\n随机数字的示例输出：\n\n![随机数字](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_1468b92b1f03.gif)\n\n2. [条件生成对抗网络（CGAN）](chapter4-gan\u002Fcgan-mnist-4.3.1.py)\n\n[Mirza, Mehdi 和 Simon Osindero. “条件生成对抗网络。” arXiv 预印本 arXiv:1411.1784 (2014)。](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1411.1784)\n\n数字 0 至 9 的示例输出：\n\n![零到九](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_2d952b30c515.gif)\n\n## [第5章 - 改进的GAN](chapter5-improved-gan)\n1. [Wasserstein GAN (WGAN)](chapter5-improved-gan\u002Fwgan-mnist-5.1.2.py)\n\n[Arjovsky, Martin, Soumith Chintala, and Léon Bottou. \"Wasserstein GAN.\" arXiv预印本 arXiv:1701.07875 (2017)。](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1701.07875)\n\n随机数字的示例输出：\n\n![随机数字](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_20725b248d1b.gif)\n\n2. [最小二乘GAN (LSGAN)](chapter5-improved-gan\u002Flsgan-mnist-5.2.1.py)\n\n[Mao, Xudong, 等. \"最小二乘生成对抗网络.\" 2017 IEEE国际计算机视觉会议（ICCV）。IEEE，2017年。](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ICCV_2017\u002Fpapers\u002FMao_Least_Squares_Generative_ICCV_2017_paper.pdf)\n\n随机数字的示例输出：\n\n![随机数字](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_8db9884341f0.gif)\n\n3. [辅助分类器GAN (ACGAN)](chapter5-improved-gan\u002Facgan-mnist-5.3.1.py)\n\n[Odena, Augustus, Christopher Olah, 和 Jonathon Shlens. \"条件图像生成与辅助分类器GAN。第34届国际机器学习大会论文集，澳大利亚悉尼，PMLR 70，2017年。\"](http:\u002F\u002Fproceedings.mlr.press\u002Fv70\u002Fodena17a.html)\n\n数字0到9的示例输出：\n\n![零到九](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_af51ad60be78.gif)\n## [第6章 - 具有解耦潜在表示的GAN](chapter6-disentangled-gan)\n1. [信息最大化GAN (InfoGAN)](chapter6-disentangled-gan\u002Finfogan-mnist-6.1.1.py)\n\n[Chen, Xi, 等. \"InfoGAN：通过信息最大化生成对抗网络实现可解释的表征学习。\"\n神经信息处理系统进展。2016年。](http:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F6399-infogan-interpretable-representation-learning-by-information-maximizing-generative-adversarial-nets.pdf)\n\n数字0到9的示例输出：\n\n![零到九](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_87930f28c5f1.gif)\n\n2. [堆叠GAN](chapter6-disentangled-gan\u002Fstackedgan-mnist-6.2.1.py)\n\n[Huang, Xun, 等. \"堆叠式生成对抗网络.\" IEEE计算机视觉与模式识别会议（CVPR）。第2卷，2017年。](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_cvpr_2017\u002Fpapers\u002FHuang_Stacked_Generative_Adversarial_CVPR_2017_paper.pdf)\n\n数字0到9的示例输出：\n\n![零到九](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_ac8e3415cfbb.gif)\n\n## [第7章 - 跨域GAN](chapter7-cross-domain-gan)\n1. [CycleGAN](chapter7-cross-domain-gan\u002Fcyclegan-7.1.1.py)\n\n[Zhu, Jun-Yan, 等. \"使用循环一致性对抗网络进行无配对图像到图像的转换.\" 2017 IEEE国际计算机视觉会议（ICCV）。IEEE，2017年。](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ICCV_2017\u002Fpapers\u002FZhu_Unpaired_Image-To-Image_Translation_ICCV_2017_paper.pdf)\n\n随机cifar10图像的示例输出：\n\n![上色图像](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_21bdcf561693.gif)\n\nMNIST到SVHN的示例输出：\n\n![MNIST2SVHN](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_d94bafec65a2.png)\n\n## [第8章 - 变分自编码器（VAE）](chapter8-vae)\n\n1. [VAE MLP MNIST](chapter8-vae\u002Fvae-mlp-mnist-8.1.1.py)\n2. [VAE CNN MNIST](chapter8-vae\u002Fcvae-cnn-mnist-8.2.1.py)\n3. [条件VAE和Beta VAE](chapter8-vae\u002Fcvae-cnn-mnist-8.2.1.py)\n\n[Kingma, Diederik P., 和 Max Welling. \"自动编码变分贝叶斯.\" arXiv预印本 arXiv:1312.6114 (2013)。](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1312.6114.pdf)\n\n[Sohn, Kihyuk, Honglak Lee, 和 Xinchen Yan. \"利用深度条件生成模型学习结构化输出表示.\" 神经信息处理系统进展。2015年。](http:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F5775-learning-structured-output-representation-using-deep-conditional-generative-models.pdf)\n\n[I. Higgins, L. Matthey, A. Pal, C. Burgess, X. Glorot, M. Botvinick, S. Mohamed, 和 A. Lerchner. β-VAE：使用约束变分框架学习基本视觉概念。ICLR，2017年。](https:\u002F\u002Fopenreview.net\u002Fpdf?id=Sy2fzU9gl)\n\n通过导航潜在空间生成的MNIST：\n\n![MNIST](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_dfb0c1869865.png)\n\n## [第9章 - 深度强化学习](chapter9-drl)\n\n1. [Q-Learning](chapter9-drl\u002Fq-learning-9.3.1.py)\n2. [Frozen Lake环境下的Q-Learning](chapter9-drl\u002Fq-frozenlake-9.5.1.py)\n3. [Cartpole环境下的DQN和DDQN](chapter9-drl\u002Fdqn-cartpole-9.6.1.py)\n\nMnih, Volodymyr, 等. \"通过深度强化学习实现人类水平控制.\" Nature 518.7540 (2015): 529\n\nCartpole环境下的DQN：\n\n![Cartpole](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_6acb22c37515.gif)\n\n## [第10章 - 策略梯度方法](chapter10-policy)\n\n1. [REINFORCE、带基线的REINFORCE、Actor-Critic、A2C](chapter10-policy\u002Fpolicygradient-car-10.1.1.py)\n\n[Sutton和Barto，《强化学习：导论》](http:\u002F\u002Fincompleteideas.net\u002Fbook\u002Fbookdraft2017nov5.pdf)\n\n[Mnih, Volodymyr, 等. \"深度强化学习的异步方法.\" 国际机器学习会议，2016年。](http:\u002F\u002Fproceedings.mlr.press\u002Fv48\u002Fmniha16.pdf)\n\n\nMountainCar连续环境下的策略梯度：\n\n![Car](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_04f8f486e46f.gif)\n\n\n## [第11章 - 目标检测](chapter11-detection)\n\n1. [单次检测](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1512.02325.pdf)\n\n对3个目标的单次检测\n![SSD](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_354be0278768.png)\n\n## [第12章 - 语义分割](chapter12-segmentation)\n\n1. [FCN](https:\u002F\u002Fwww.cv-foundation.org\u002Fopenaccess\u002Fcontent_cvpr_2015\u002Fpapers\u002FLong_Fully_Convolutional_Networks_2015_CVPR_paper.pdf)\n\n2. [PSPNet](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_cvpr_2017\u002Fpapers\u002FZhao_Pyramid_Scene_Parsing_CVPR_2017_paper.pdf)\n\n语义分割\n\n![语义分割](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_bc5be48610e5.png)\n\n## [第13章 - 基于互信息的无监督学习](chapter13-mi-unsupervised)\n\n\n1. [不变信息聚类](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ICCV_2019\u002Fpapers\u002FJi_Invariant_Information_Clustering_for_Unsupervised_Image_Classification_and_Segmentation_ICCV_2019_paper.pdf)\n\n2. [MINE：互信息估计](http:\u002F\u002Fproceedings.mlr.press\u002Fv80\u002Fbelghazi18a\u002Fbelghazi18a.pdf)\n\n\nMINE\n![MINE](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_readme_725cd82398c3.png)\n\n## 引用\n如果您觉得这项工作有用，请引用：\n\n```\n@book{atienza2020advanced,\n  title={使用TensorFlow 2和Keras的高级深度学习：应用深度学习、GAN、VAE、深度强化学习、无监督学习、目标检测和分割等},\n  author={Atienza, Rowel},\n  year={2020},\n  publisher={Packt Publishing Ltd}\n}\n```","# Advanced-Deep-Learning-with-Keras 快速上手指南\n\n本指南基于《Advanced Deep Learning with TensorFlow 2 and Keras (2nd Edition)》配套代码库，帮助开发者快速搭建环境并运行示例。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**: 推荐 Ubuntu 18.04 LTS 或更高版本（Linux 环境对 GPU 支持最友好）。\n*   **硬件要求**: \n    *   至少配备 1 块 NVIDIA GPU（推荐 GTX 1060 或更高型号，如 1080Ti, RTX 2080Ti, V100 等）。\n    *   若仅使用 CPU 运行，速度将显著降低且部分大型模型可能无法训练。\n*   **软件依赖**:\n    *   **Anaconda**: 用于管理 Python 环境和依赖包。\n    *   **NVIDIA Driver & CUDA**: 需安装匹配的显卡驱动和 CUDA 工具包（原文测试环境为 Driver 440.64 + CUDA 10.2）。\n    *   **系统工具**: `python-pydot`, `ffmpeg` (用于生成动图演示)。\n\n> **国内加速建议**：\n> *   下载 Anaconda 可使用清华镜像源：https:\u002F\u002Fmirrors.tuna.tsinghua.edu.cn\u002Fanaconda\u002Farchive\u002F\n> *   安装 Python 包时，建议临时切换至国内 pip 源（如阿里云或清华源）以加快下载速度。\n\n## 安装步骤\n\n以下步骤将创建一个独立的 Conda 环境并安装所有必要依赖。\n\n### 1. 安装 Anaconda\n下载并运行安装脚本（以 Linux 为例）：\n```bash\nsh \u003Cname-of-downloaded-Anaconda3-installer>\n```\n\n### 2. 配置 NVIDIA 驱动与 CUDA (Linux)\n如果您尚未安装驱动，可参考以下命令自动安装（需 sudo 权限）：\n```bash\nsudo add-apt-repository ppa:graphics-drivers\u002Fppa\nsudo apt update\nsudo ubuntu-drivers autoinstall\nsudo reboot\n```\n重启后验证驱动状态：\n```bash\nnvidia-smi\n```\n\n### 3. 创建 Conda 环境并克隆代码\n```bash\n# 创建名为 packt 的新环境\nconda create --name packt\n\n# 激活环境\nconda activate packt\n\n# 进入目标目录并克隆仓库\ncd \u003Cgithub-dir>\ngit clone https:\u002F\u002Fgithub.com\u002FPacktPublishing\u002FAdvanced-Deep-Learning-with-Keras\ncd Advanced-Deep-Learning-with-Keras\n```\n\n### 4. 安装项目依赖\n```bash\n# 安装 requirements.txt 中的依赖\n# 提示：若下载缓慢，可添加 -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple 参数\npip install -r requirements.txt\n\n# 安装系统级辅助工具\nsudo apt-get install python-pydot\nsudo apt-get install ffmpeg\n```\n\n### 5. 备选方案：解决 CUDA 库问题\n如果在运行时遇到 `libcudart.so` 找不到或 TensorFlow 无法加载 GPU 的错误，建议使用 Conda 统一安装 TensorFlow-GPU：\n```bash\npip uninstall tensorflow-gpu\nconda install -c anaconda tensorflow-gpu\n```\n\n## 基本使用\n\n安装完成后，可以通过运行第一章的简单示例来验证环境是否配置成功。该示例将在 MNIST 数据集上训练一个多层感知机（MLP）。\n\n### 运行第一个示例\n```bash\ncd chapter1-keras-quick-tour\npython3 mlp-mnist-1.3.2.py\n```\n\n### 预期结果\n程序将开始训练模型。训练完成后，终端应输出类似以下信息，显示模型在 MNIST 测试集上的准确率约为 **98.2%**：\n```text\n...\nTest accuracy: 0.982\n```\n\n### 探索更多示例\n本项目按书籍章节组织了丰富的深度学习案例，您可以直接运行对应章节的脚本：\n*   **CNN\u002FRNN**: `chapter1-keras-quick-tour\u002Fcnn-mnist-1.4.1.py`\n*   **ResNet\u002FDenseNet**: `chapter2-deep-networks\u002Fresnet-cifar10-2.2.1.py`\n*   **GAN (生成对抗网络)**: `chapter4-gan\u002Fdcgan-mnist-4.2.1.py`\n*   **VAE (变分自编码器)**: `chapter8-vae\u002Fvae-mlp-mnist-8.1.1.py`\n*   **强化学习 (DQN)**: `chapter9-drl\u002Fdqn-cartpole-9.6.1.py`\n\n所有生成的图像结果（如去噪图片、生成的人脸、游戏演示 GIF）通常保存在各章节下的 `saved_images` 或 `images` 文件夹中。","某医疗影像初创公司的算法团队正致力于开发一套能自动识别皮肤病变并生成合成数据以扩充训练集的智能诊断系统。\n\n### 没有 Advanced-Deep-Learning-with-Keras 时\n- 团队需从零摸索变分自编码器（VAE）和生成对抗网络（GAN）的复杂架构，常因代码调试困难导致生成的合成病灶图像失真，无法用于实际训练。\n- 在尝试引入语义分割技术（如 FCN）精准勾勒肿瘤边缘时，缺乏现成的最佳实践参考，导致模型收敛极慢且分割精度长期停滞不前。\n- 面对深度强化学习（DRL）在动态诊疗路径规划中的应用需求，团队成员需自行推导策略梯度算法公式，研发周期被大幅拉长。\n- 现有开源代码多基于过时的 TensorFlow 1.x 版本，迁移至 TensorFlow 2.0 Keras API 时频繁遭遇兼容性报错，严重拖慢项目进度。\n\n### 使用 Advanced-Deep-Learning-with-Keras 后\n- 直接复用书中经过验证的 VAE 与 GAN 实战项目，快速生成了高保真度的皮肤病变合成数据，显著提升了小样本场景下的模型泛化能力。\n- 借助书中关于 FCN 和 PSPNet 的完整章节指导，迅速搭建起高精度的语义分割流水线，实现了对病灶区域的像素级精准定位。\n- 利用书中提供的 Deep Q-Learning 和策略梯度方法代码模板，高效完成了智能诊疗决策模块的原型开发，将算法落地时间缩短了一半。\n- 所有示例代码均已原生适配 TensorFlow 2.x Keras API，团队无需处理繁琐的版本迁移问题，直接在 GPU 环境中跑通了从 MLP 到 ResNet 的全套流程。\n\nAdvanced-Deep-Learning-with-Keras 通过提供前沿且可落地的代码实战方案，帮助团队跨越了从理论算法到高性能 AI 产品的鸿沟。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPacktPublishing_Advanced-Deep-Learning-with-Keras_50799d3d.png","PacktPublishing","Packt","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FPacktPublishing_6d855195.jpg","Providing books, eBooks, video tutorials, and articles for IT developers, administrators, and users.",null,"https:\u002F\u002Fwww.packtpub.com","https:\u002F\u002Fgithub.com\u002FPacktPublishing",[81],{"name":82,"color":83,"percentage":84},"Python","#3572A5",100,1988,1026,"2026-04-13T14:40:12","MIT","Linux","必需。至少需要 1 块 NVIDIA GPU（GTX 1060 或更高型号）。测试环境包括 GTX 1060, 1080Ti, RTX 2080Ti, V100, RTX Quadro 8000。配套 CUDA 版本为 10.2，NVIDIA 驱动版本 440.64。","未说明",{"notes":93,"python":94,"dependencies":95},"1. 强烈建议使用 Conda 管理运行环境。2. 代码示例已更新仅支持 TensorFlow 2.0 Keras API。3. 若遇到 CUDA 库加载问题（如找不到 libcudart.so），可通过 conda 统一安装 tensorflow-gpu 以解决依赖冲突。4. 需要安装 graphviz 相关包 (python-pydot) 用于模型可视化。5. 需要安装 ffmpeg 用于处理视频或生成 GIF 动图。","未说明 (通过 conda 环境安装)",[96,97,98,99,100,101,102,103,104],"tensorflow-gpu","keras","python-pydot","ffmpeg","numpy","scipy","matplotlib","pillow","h5py",[15,14],[97,107,108,109,110,111],"gan","vae","reinforcement-learning","autoencoder","deep-learning","2026-03-27T02:49:30.150509","2026-04-15T03:27:47.948506",[115,120,125,130,135,140],{"id":116,"question_zh":117,"answer_zh":118,"source_url":119},33557,"在自定义数据集上运行图像分割训练时遇到 OOM（显存溢出）错误或类别数量不匹配怎么办？","如果遇到 OOM 错误，通常是因为输入尺寸过大或显存不足。对于类别数量错误（例如代码默认为 4 类但实际只需 3 类），需要修改 `generate_gt_segmentation.py` 文件。将第 51 行左右的代码：\n`image = ...`\n修改为明确指定类别数量的形式：\n`image = np.ones((w, h, n_classes), dtype=\"uint8\")`\n其中 `(w, h)` 是你的图像尺寸，`n_classes` 应设为实际类别数（例如 2 个前景类 + 1 个背景类 = 3）。同时确保掩码生成逻辑正确对应背景类。","https:\u002F\u002Fgithub.com\u002FPacktPublishing\u002FAdvanced-Deep-Learning-with-Keras\u002Fissues\u002F16",{"id":121,"question_zh":122,"answer_zh":123,"source_url":124},33558,"CVAE 模型训练后，测试集上的 z_mean 编码值全部相同且不符合正态分布，这是为什么？","CVAE 和 VAE 的编码器目标是将 `z_mean` 分布近似为零均值、标准差为 1 的高斯分布。如果在测试集上发现值恒定，可能是验证方法有误。可以通过以下代码验证编码器输出是否符合预期分布：\n\n```python\nz, _, _ = encoder.predict([x_test, to_categorical(y_test)], batch_size=batch_size)\nprint(\"shape:\", z.shape)\nprint(\"mean:\", np.mean(z, axis=0))\nprint(\"std:\", np.std(z, axis=0))\n```\n\n正常输出应显示均值接近 0，标准差接近 1（例如 mean: [0.07, 0.02], std: [0.91, 0.92]），而不是所有值完全相同。如果确实全相同，请检查标签输入 `y_labels` 是否正确传递给了编码器。","https:\u002F\u002Fgithub.com\u002FPacktPublishing\u002FAdvanced-Deep-Learning-with-Keras\u002Fissues\u002F17",{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},33559,"SSD 模型中 `get_n_boxes` 函数计算锚框数量的公式 `np.prod(shape) \u002F\u002F self.n_anchors` 是否正确？是否应该乘以锚框数？","该公式在特定条件下（默认每个特征点有 4 个锚框且偏移量为 4 维）看似是除法，实则是为了抵消后续处理中的维度扩展。`self.n_boxes` 代表所有特征层的总锚框数。虽然代码写法 `\u002F\u002F self.n_anchors` 容易引起误解，但在默认配置下（n_anchors=4，offsets=4），计算结果是正确的。如果要修改纵横比（aspect ratio）导致锚框数变化，需仔细检查 `data_generation` 中生成 ground truth 类别、偏移量和掩码的逻辑，确保总框数与 `self.n_boxes` 一致。","https:\u002F\u002Fgithub.com\u002FPacktPublishing\u002FAdvanced-Deep-Learning-with-Keras\u002Fissues\u002F8",{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},33560,"运行 DCGAN 代码时报错 'You must feed a value for placeholder tensor discriminator_input' 如何解决？","此错误通常由 TensorFlow 版本不兼容引起。原代码基于 TensorFlow 1.x 编写，使用了占位符（placeholder）。如果你使用的是 TensorFlow 2.x，需要升级环境或调整代码。最简单的解决方法是将 TensorFlow 版本从 1.15.0 升级到 2.0.0 或更高版本（如 2.4.1），TF2 会自动处理图执行模式，从而消除该占位符错误。","https:\u002F\u002Fgithub.com\u002FPacktPublishing\u002FAdvanced-Deep-Learning-with-Keras\u002Fissues\u002F15",{"id":136,"question_zh":137,"answer_zh":138,"source_url":139},33561,"在 Windows 系统上运行 DCGAN、CGAN 或 WGAN 模型时出现 InvalidArgumentError 怎么办？","这是一个已知在 Windows 上使用 TensorFlow 2 时可能出现的兼容性问题。代码和结果主要在 Ubuntu Linux (18.04 LTS) 上验证通过。建议尝试以下方案：\n1. 检查并重新安装 TensorFlow 2.4.1 或更高版本。\n2. 如果可能，建议在 Linux 环境（如 WSL2 或虚拟机）中运行代码。\n3. 确认输入数据形状和类型是否与模型定义完全匹配（例如 [?,28,28,1] float32）。","https:\u002F\u002Fgithub.com\u002FPacktPublishing\u002FAdvanced-Deep-Learning-with-Keras\u002Fissues\u002F14",{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},33562,"修改 SSD 模型的锚框纵横比（aspect ratio）后，检测框数量计算出错的原因是什么？","在 `chapter11-detection\u002Fdata_generator.py` 的 `get_n_boxes` 函数中，默认使用 `\u002F\u002F self.n_anchors` 是因为默认设置下锚框数（aspect_ratios + 1）等于 4，恰好与坐标偏移量维度（xmin, ymin, xmax, ymax）相抵消。如果修改了纵横比导致 `n_anchors` 不再是 4，该除法逻辑就会出错。此时应根据实际的特征图尺寸和每个点的锚框数重新计算总框数，公式应为 `np.prod(shape) * actual_anchors_per_point`，并同步调整后续生成 ground truth 数据的逻辑。","https:\u002F\u002Fgithub.com\u002FPacktPublishing\u002FAdvanced-Deep-Learning-with-Keras\u002Fissues\u002F13",[]]