[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-google-research--disentanglement_lib":3,"tool-google-research--disentanglement_lib":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":79,"owner_email":79,"owner_twitter":79,"owner_website":80,"owner_url":81,"languages":82,"stars":91,"forks":92,"last_commit_at":93,"license":94,"difficulty_score":10,"env_os":95,"env_gpu":96,"env_ram":97,"env_deps":98,"category_tags":108,"github_topics":79,"view_count":23,"oss_zip_url":79,"oss_zip_packed_at":79,"status":16,"created_at":109,"updated_at":110,"faqs":111,"releases":142},2009,"google-research\u002Fdisentanglement_lib","disentanglement_lib","disentanglement_lib is an open-source library for research on learning disentangled representations.","disentanglement_lib 是一个开源库，专门用于研究和评估无监督学习中的“解耦表征”——即让模型自动从复杂数据中分离出独立的语义因子（如形状、颜色、位置等）。它解决了当前无监督学习中难以量化和比较不同模型解耦效果的问题，提供了一套标准化的模型、评估指标和数据集，帮助研究人员更可靠地验证假设。内置 BetaVAE、FactorVAE 等主流模型，以及 Mutual Information Gap、DCI 等十余种评估指标，并支持 dSprites、Shapes3D 等经典数据集，还预训练了上万个模型供直接调用。适合机器学习研究人员、AI 学生和算法工程师使用，尤其适合从事表示学习、生成模型或可解释性研究的群体。其独特亮点在于将训练、后处理、评估与可视化全流程自动化，并通过统一配置系统和 JSON 结果聚合，极大提升了实验的可复现性与效率。所有操作均基于 TensorFlow，支持 Linux 环境，开箱即用。","# disentanglement_lib\n![Sample visualization](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fgoogle-research_disentanglement_lib_readme_979247913509.gif)\n\n**disentanglement_lib** is an open-source library for research on learning disentangled representation.\nIt supports a variety of different models, metrics and data sets:\n\n* *Models*: BetaVAE, FactorVAE, BetaTCVAE, DIP-VAE\n* *Metrics*: BetaVAE score, FactorVAE score, Mutual Information Gap, SAP score, DCI, MCE, IRS, UDR\n* *Data sets*: dSprites, Color\u002FNoisy\u002FScream-dSprites, SmallNORB, Cars3D, and Shapes3D\n* It also includes 10'800 pretrained disentanglement models (see below for details).\n\ndisentanglement_lib was created by Olivier Bachem and Francesco Locatello at Google Brain Zurich for the large-scale empirical study\n\n> [**Challenging Common Assumptions in the Unsupervised Learning of Disentangled Representations.**](https:\u002F\u002Farxiv.org\u002Fabs\u002F1811.12359)\n> *Francesco Locatello, Stefan Bauer, Mario Lucic, Gunnar Rätsch, Sylvain Gelly, Bernhard Schölkopf, Olivier Bachem*. ICML (Best Paper Award), 2019.\n\nThe code is tested with Python 3 and is meant to be run on Linux systems (such as a [Google Cloud Deep Learning VM](https:\u002F\u002Fcloud.google.com\u002Fdeep-learning-vm\u002Fdocs\u002F)).\nIt uses TensorFlow, Scipy, Numpy, Scikit-Learn, TFHub and Gin.\n\n## How does it work?\ndisentanglement_lib consists of several different steps:\n\n* **Model training**: Trains a TensorFlow model and saves trained model in a TFHub module.\n* **Postprocessing**: Takes a trained model, extracts a representation (e.g. by using the mean of the Gaussian encoder) and saves the representation function in a TFHub module.\n* **Evaluation**: Takes a representation function and computes a disentanglement metric.\n* **Visualization**: Takes a trained model and visualizes it.\n\nAll configuration details and experimental results of the different steps are saved and propagated along the steps (see below for a description).\nAt the end, they can be aggregated in a single JSON file and analyzed with Pandas.\n\n\n## Usage\n### Installing disentanglement_lib\nFirst, clone this repository with\n\n```\ngit clone https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fdisentanglement_lib.git\n```\n\nThen, navigate to the repository (with `cd disentanglement_lib`) and run\n\n```\npip install .[tf_gpu]\n```\n\n(or `pip install .[tf]` for TensorFlow without GPU support).\nThis should install the package and all the required dependencies.\nTo verify that everything works, simply run the test suite with\n\n```\ndlib_tests\n```\n\n### Downloading the data sets\nTo download the data required for training the models, navigate to any folder and run\n\n```\ndlib_download_data\n```\n\nwhich will install all the required data files (except for Shapes3D which is not\npublicly released) in the current working directory.\nFor convenience, we recommend to set the environment variable `DISENTANGLEMENT_LIB_DATA` to this path, for example by adding\n\n```\nexport DISENTANGLEMENT_LIB_DATA=\u003Cpath to the data directory>\n```\nto your `.bashrc` file. If you choose not to set the environment variable `DISENTANGLEMENT_LIB_DATA`, disentanglement_lib will always look for the data in your current folder.\n\n### Reproducing prior experiments\n\nTo fully train and evaluate one of the 12'600 models in the paper [*Challenging Common Assumptions in the Unsupervised Learning of Disentangled Representations*](https:\u002F\u002Farxiv.org\u002Fabs\u002F1811.12359), simply run\n\n```\ndlib_reproduce --model_num=\u003C?>\n```\n\nwhere `\u003C?>` should be replaced with a model index between 0 and 12'599 which\ncorresponds to the ID of which model to train.\nThis will take a couple of hours and add a folder `output\u002F\u003C?>` which contains the trained model (including checkpoints and TFHub modules), the experimental results (in JSON format) and visualizations (including GIFs).\nTo only print the configuration of that model instead of training, add the flag `--only_print`.\n\nAfter having trained several of these models, you can aggregate the results by running\nthe following command (in the same folder)\n\n```\ndlib_aggregate_results\n```\nwhich creates a `results.json` file with all the aggregated results.\n\n\n### Running different configurations\nInternally, disentanglement_lib uses [gin](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgin-config) to configure hyperparameters and other settings.\nTo train one of the provided models but with different hyperparameters, you need to write a gin config such as `examples\u002Fmodel.gin`.\nThen, you may use the following command\n\n```\ndlib_train --gin_config=examples\u002Fmodel.gin --model_dir=\u003Cmodel_output_directory>\n```\nto train the model where `--model_dir` specifies where the results should be saved.\n\nTo evaluate the newly trained model consistent with the evaluation protocol in the paper [*Challenging Common Assumptions in the Unsupervised Learning of Disentangled Representations*](https:\u002F\u002Farxiv.org\u002Fabs\u002F1811.12359), simply run\n\n```\ndlib_reproduce --model_dir=\u003Cmodel_output_directory> --output_directory=\u003Coutput>\n```\nSimilarly, you might also want to look at `dlib_postprocess` and `dlib_evaluate` if you want to customize how representations are extracted and evaluated.\n\n### Starting your own research\ndisentanglement_lib is easily extendible and can be used to implement new models and metrics related to disentangled representations.\nTo get started, simply go through `examples\u002Fexample.py` which shows you how to create your own disentanglement model and metric and how to benchmark them against existing models and metrics.\n\n## Pretrained disentanglement_lib modules\nReproducing all the 12'600 models in the study [*Challenging Common Assumptions in the Unsupervised Learning of Disentangled Representations*](https:\u002F\u002Farxiv.org\u002Fabs\u002F1811.12359) requires a substantial computational effort.\nTo foster further research, **disentanglement_lib includes 10'800 pretrained disentanglement_lib modules** that correspond to the results of running `dlib_reproduce` with `--model_num=\u003C?>` between 0 and 10'799 (the other models correspond to Shapes3D which is not publicly available).\nEach disentanglement_lib module contains the trained model (in the form of a TFHub module), the extracted representations (also as TFHub modules) and the recorded experimental results such as the different disentanglement scores (in JSON format).\nThis makes it easy to compare new models to the pretrained ones and to compute new disentanglement metrics on the set of pretrained models.\n\nTo access the 10'800 pretrained disentanglement_lib modules, you may download individual ones using the following link:\n\n```\nhttps:\u002F\u002Fstorage.googleapis.com\u002Fdisentanglement_lib\u002Funsupervised_study_v1\u002F\u003C?>.zip\n```\nwhere `\u003C?>` corresponds to a model index between 0 and 10'799 ([example](https:\u002F\u002Fstorage.googleapis.com\u002Fdisentanglement_lib\u002Funsupervised_study_v1\u002F0.zip)).\n\nEach ZIP file in the bucket corresponds to one run of `dlib_reproduce` with that model number.\nTo learn more about the used configuration settings, look at the code in `disentanglement_lib\u002Fconfig\u002Funsupervised_study_v1\u002Fsweep.py` or run:\n\n```\ndlib_reproduce --model_num=\u003C?> --only_print\n```\n\n## Frequently asked questions\n\n### How do I make pretty GIFs of my models?\nIf you run `dlib_reproduce`, they are automatically saved to the `visualizations` subfolder in your output directory. Otherwise, you can use the script `dlib_visualize_dataset` to generate them or call the function `visualize(...)` in `disentanglement_lib\u002Fvisualize\u002Fvisualize_model.py`.\n\n### How are results and models saved?\nAfter each of the main steps (training\u002Fpostprocessing\u002Fevaluation), an output directory is created.\nFor all steps, there is a `results` folder which contains all the configuration settings and experimental results up to that step.\nThe `gin` subfolder contains the operative gin config for each step in the gin format.\nThe `json` subfolder contains files with the operative gin config and the experimental results of that step but in JSON format.\nFinally, the `aggregate` subfolder contains aggregated JSON files where each file contains both the configs and results from all preceding steps.\n\nThe training step further saves the TensorFlow checkpoint (in a `tf_checkpoint` subfolder) and the trained model as a TFHub module (in a `tfhub` subfolder). Similarly, the postprocessing step saves the representation function as a TFHub module (in a `tfhub` subfolder).\nIf you run `dlib_reproduce`, it will create subfolders for all the different substeps that you ran. In particular, it will create an output directory for each metric that you computed.\n\n### How do I access the results?\n\nTo access the results, first aggregate all the results using `dlib_aggregate_results` by specifying a glob pattern that captures all the results files.\nFor example, after training a couple of different models with `dlib_reproduce`, you would specify\n\n```\ndlib_aggregate --output_path=\u003C...>.json \\\n  --result_file_pattern=\u003C...>\u002F*\u002Fmetrics\u002F*\u002F*\u002Fresults\u002Faggregate\u002Fevaluation.json\n```\nThe first * in the glob pattern would capture the different models, the second * different representations and the last * the different metrics.\nFinally, you may access the aggregated results with:\n\n```python\nfrom disentanglement_lib.utils import aggregate_results\ndf = aggregate_results.load_aggregated_json_results(output_path)\n```\n## Where to look in the code?\n\nThe following provides a guide to the overall code structure:\n\n**(1) Training step:**\n\n* `disentanglement_lib\u002Fmethods\u002Funsupervised`:\nContains the training protocol (`train.py`) and all the model functions\nfor training the methods (`vae.py`). The methods all inherit from the\n`GaussianEncoderModel` class.\n* `disentanglement_lib\u002Fmethods\u002Fshared`:\n Contains shared architectures, losses, and optimizers used in the different models.\n\n**(2) Postprocessing step:**\n\n* `disentanglement_lib\u002Fpostprocess`:\nContains the postprocessing pipeline (`postprocess.py`) and the two extraction methods (`methods.py`).\n\n**(3) Evaluation step:**\n\n* `disentanglement_lib\u002Fevaluation`: Contains the evaluation protocol (`evaluate.py`).\n\n* `disentanglement_lib\u002Fevaluation\u002Fmetrics`:\nContains implementation of the different disentanglement metrics.\n\n**Hyperparameters and configuration files:**\n\n* `disentanglement_lib\u002Fconfig\u002Funsupervised_study_v1`:\nContains the gin configuration files (`*.gin`) for the different steps as well as the hyperparameter sweep (`sweep.py`) for the experiments in the paper *Challenging Common Assumptions in the Unsupervised Learning of Disentangled Representations*.\n\n**Shared functionality:**\n\n* `bin`: Scripts to run the different pipelines, visualize the data sets as well as the models and aggregate the results.\n\n* `disentanglement_lib\u002Fdata\u002Fground_truth`:\nContains all the scripts used to generate the data. All the datasets (in `named_data.py`) are instances of the class `GroundTruthData}`.\n\n* `disentanglement_lib\u002Futils`:\nContains helper functions to aggregate and save the results of the pipeline as well as the trained models.\n\n* `disentanglement_lib\u002Fvisualize`:\nContains visualization functions for the datasets and the trained models.\n\n## NeurIPS 2019 Disentanglement Challenge\n\nThe library is also used for the [NeurIPS 2019 Disentanglement challenge](https:\u002F\u002Fwww.aicrowd.com\u002Fchallenges\u002Fneurips-2019-disentanglement-challenge). The challenge consists of three different datasets.\n 1. Simplistic rendered images ([mpi3d_toy](https:\u002F\u002Fstorage.googleapis.com\u002Fdisentanglement_dataset\u002Fdata_npz\u002Fsim_toy_64x_ordered_without_heldout_factors.npz))\n 2. Realistic rendered images (mpi3d_realistic): _not yet published_\n 3. Real world images (mpi3d_real): _not yet published_\n\n Currently, only the simplistic rendered dataset is publicly available and will be automatically downloaded by running the following command.\n ```\ndlib_download_data\n```\nOther datasets will be made available at the later stages of the competition. For more information on the competition kindly visit the [competition website](https:\u002F\u002Fwww.aicrowd.com\u002Fchallenges\u002Fneurips-2019-disentanglement-challenge). More information about the dataset can be found [here](https:\u002F\u002Fgithub.com\u002Frr-learning\u002Fdisentanglement_dataset) or in the arXiv preprint [On the Transfer of Inductive Bias from Simulation to the Real World: a New Disentanglement Dataset](https:\u002F\u002Farxiv.org\u002Fabs\u002F1906.03292).\n\n\n## Abstract reasoning experiments\n\nThe library also includes the code used for the experiments of the following paper in the `disentanglement_lib\u002Fevaluation\u002Fabstract_reasoning` subdirectory:\n> [**Are Disentangled Representations Helpful for Abstract Visual Reasoning?**](https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.12506)\n> *Sjoerd van Steenkiste, Francesco Locatello, Jürgen Schmidhuber, Olivier Bachem*. NeurIPS, 2019.\n\nThe experimental protocol consists of two parts:\nFirst, to train the disentanglement models, one may use the  the standard replication pipeline (`dlib_reproduce`), for example via the following command:\n\n```\ndlib_reproduce --model_num=\u003C?> --study=abstract_reasoning_study_v1\n```\nwhere `\u003C?>` should be replaced with a model index between 0 and 359 which\ncorresponds to the ID of which model to train.\n\nSecond, to train the abstract reasoning models, one can use the automatically installed pipeline `dlib_reason`.\nTo configure the model, copy and modify `disentanglement_lib\u002Fconfig\u002Fabstract_reasoning_study_v1\u002Fstage2\u002Fexample.gin` as needed.\nThen, use the following command to train and evaluate an abstract reasoning model:\n\n```\ndlib_reason --gin_config=\u003C?> --input_dir=\u003C?> --output_dir=\u003C?>\n```\nThe results can then be found in the `results` subdirectory of the output directory.\n\n## Fairness experiments\n\nThe library also includes the code used for the experiments of the following paper in `disentanglement_lib\u002Fevaluation\u002Fmetrics\u002Ffairness.py`:\n> [**On the Fairness of Disentangled Representations**](https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.13662)\n> *Francesco Locatello, Gabriele Abbati, Tom Rainforth, Stefan Bauer, Bernhard Schoelkopf, Olivier Bachem*. NeurIPS, 2019.\n\nTo train and evaluate all the models, simply use the following command:\n\n```\ndlib_reproduce --model_num=\u003C?> --study=fairness_study_v1\n```\nwhere `\u003C?>` should be replaced with a model index between 0 and 12'599 which\ncorresponds to the ID of which model to train.\n\nIf you only want to reevaluate an already trained model using the evaluation protocol of the paper, you may use the following command:\n\n```\ndlib_reproduce --model_dir=\u003Cmodel_output_directory> --output_directory=\u003Coutput> --study=fairness_study_v1\n```\n\n## UDR experiments\n\nThe library also includes the code for the Unsupervised Disentanglement Ranking (UDR) method proposed in the following paper in `disentanglement_lib\u002Fbin\u002Fdlib_udr`:\n> [**Unsupervised Model Selection for Variational Disentangled Representation Learning**](https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.12614)\n> *Sunny Duan, Loic Matthey, Andre Saraiva, Nicholas Watters, Christopher P. Burgess, Alexander Lerchner, Irina Higgins*.\n\nUDR can be applied to newly trained models (e.g. obtained by running\n`dlib_reproduce`) or to the existing pretrained models. After the models have\nbeen trained, their UDR scores can be computed by running:\n\n```\ndlib_udr --model_dirs=\u003Cmodel_output_directory1>,\u003Cmodel_output_directory2> \\\n  --output_directory=\u003Coutput>\n```\n\nThe scores will be exported to `\u003Coutput>\u002Fresults\u002Faggregate\u002Fevaluation.json`\nunder the model_scores attribute. The scores will be presented in the order of\nthe input model directories.\n\n## Weakly-Supervised experiments\nThe library also includes the code for the weakly-supervised disentanglement methods proposed in the following paper in `disentanglement_lib\u002Fbin\u002Fdlib_reproduce_weakly_supervised`:\n> [**Weakly-Supervised Disentanglement Without Compromises**](https:\u002F\u002Farxiv.org\u002Fabs\u002F2002.02886)\n> *Francesco Locatello, Ben Poole, Gunnar Rätsch, Bernhard Schölkopf, Olivier Bachem, Michael Tschannen*.\n\n```\ndlib_reproduce_weakly_supervised --output_directory=\u003Coutput> \\\n   --gin_model_config_dir=\u003Cdir> \\\n   --gin_model_config_name=\u003Cname> \\\n   --gin_postprocess_config_glob=\u003Cpostprocess_configs> \\\n   --gin_evaluation_config_glob=\u003Ceval_configs> \\\n   --pipeline_seed=\u003Cseed>\n```\n\n## Semi-Supervised experiments\nThe library also includes the code for the semi-supervised disentanglement methods proposed in the following paper in `disentanglement_lib\u002Fbin\u002Fdlib_reproduce_semi_supervised`:\n> [**Disentangling Factors of Variation Using Few Labels**](https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.01258)\n> *Francesco Locatello, Michael Tschannen, Stefan Bauer, Gunnar Rätsch, Bernhard Schölkopf, Olivier Bachem*.\n\n```\ndlib_reproduce_weakly_supervised --output_directory=\u003Coutput> \\\n   --gin_model_config_dir=\u003Cdir> \\\n   --gin_model_config_name=\u003Cname> \\\n   --gin_postprocess_config_glob=\u003Cpostprocess_configs> \\\n   --gin_evaluation_config_glob=\u003Ceval_configs> \\\n   --gin_validation_config_glob=\u003Cval_configs> \\\n   --pipeline_seed=\u003Cseed> \\\n   --eval_seed=\u003Cseed> \\\n   --supervised_seed=\u003Cseed> \\\n   --num_labelled_samples=\u003Cnum> \\\n   --train_percentage=0.9 \\\n   --labeller_fn=\"@perfect_labeller\"\n```\n\n## Feedback\nPlease send any feedback to bachem@google.com and francesco.locatello@tuebingen.mpg.de.\n\n## Citation\nIf you use **disentanglement_lib**, please consider citing:\n\n```\n@inproceedings{locatello2019challenging,\n  title={Challenging Common Assumptions in the Unsupervised Learning of Disentangled Representations},\n  author={Locatello, Francesco and Bauer, Stefan and Lucic, Mario and Raetsch, Gunnar and Gelly, Sylvain and Sch{\\\"o}lkopf, Bernhard and Bachem, Olivier},\n  booktitle={International Conference on Machine Learning},\n  pages={4114--4124},\n  year={2019}\n}\n```\n\n### This is not an officially supported Google product.\n\n","# disentanglement_lib\n![示例可视化](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fgoogle-research_disentanglement_lib_readme_979247913509.gif)\n\n**disentanglement_lib** 是一个用于研究学习解纠缠表征的开源库。\n它支持多种不同的模型、指标和数据集：\n\n* *模型*: BetaVAE、FactorVAE、BetaTCVAE、DIP-VAE\n* *指标*: BetaVAE 分数、FactorVAE 分数、互信息差距、SAP 分数、DCI、MCE、IRS、UDR\n* *数据集*: dSprites、Color\u002FNoisy\u002FScream-dSprites、SmallNORB、Cars3D 和 Shapes3D\n* 它还包含 10,800 个预训练的解纠缠模型（详情见下文）。\n\ndisentanglement_lib 由谷歌大脑苏黎世的 Olivier Bachem 和 Francesco Locatello 创建，用于大规模实证研究\n\n> [**挑战解纠缠表征无监督学习中的常见假设。**](https:\u002F\u002Farxiv.org\u002Fabs\u002F1811.12359)\n> *Francesco Locatello、Stefan Bauer、Mario Lucic、Gunnar Rätsch、Sylvain Gelly、Bernhard Schölkopf、Olivier Bachem*。ICML（最佳论文奖），2019 年。\n\n该代码使用 Python 3 测试，旨在运行在 Linux 系统上（例如 [Google Cloud 深度学习虚拟机](https:\u002F\u002Fcloud.google.com\u002Fdeep-learning-vm\u002Fdocs\u002F))。\n它使用 TensorFlow、Scipy、Numpy、Scikit-Learn、TFHub 和 Gin。\n\n## 它是如何工作的？\ndisentanglement_lib 包含多个不同的步骤：\n\n* **模型训练**: 训练一个 TensorFlow 模型，并将训练好的模型保存为 TFHub 模块。\n* **后处理**: 获取一个训练好的模型，提取表征（例如通过使用高斯编码器的均值），并将表征函数保存为 TFHub 模块。\n* **评估**: 获取一个表征函数并计算解纠缠指标。\n* **可视化**: 获取一个训练好的模型并进行可视化。\n\n所有配置细节和不同步骤的实验结果都会被保存并沿步骤传播（详见下文）。最后，它们可以汇总到一个 JSON 文件中，并用 Pandas 进行分析。\n\n\n## 使用方法\n### 安装 disentanglement_lib\n首先，克隆此仓库：\n\n```\ngit clone https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fdisentanglement_lib.git\n```\n\n然后，进入仓库目录（使用 `cd disentanglement_lib`），运行：\n\n```\npip install .[tf_gpu]\n```\n\n（或 `pip install .[tf]` 以安装不带 GPU 支持的 TensorFlow）。\n这将安装该包及所有必需的依赖项。\n要验证一切是否正常工作，只需运行测试套件：\n\n```\ndlib_tests\n```\n\n### 下载数据集\n要下载训练模型所需的数据，进入任意文件夹并运行：\n\n```\ndlib_download_data\n```\n\n这将在当前工作目录中安装所有必需的数据文件（Shapes3D 数据集除外，因为它并未公开发布）。\n为方便起见，我们建议将环境变量 `DISENTANGLEMENT_LIB_DATA` 设置为此路径，例如在你的 `.bashrc` 文件中添加：\n\n```\nexport DISENTANGLEMENT_LIB_DATA=\u003C数据目录路径>\n```\n\n如果你选择不设置环境变量 `DISENTANGLEMENT_LIB_DATA`，disentanglement_lib 将始终在当前文件夹中查找数据。\n\n### 复现先前实验\n\n要完整训练并评估论文《挑战解纠缠表征无监督学习中的常见假设》中 12,600 个模型之一，只需运行：\n\n```\ndlib_reproduce --model_num=\u003C?>\n```\n\n其中 `\u003C?>` 应替换为 0 到 12,599 之间的模型索引，对应于要训练的模型 ID。\n这将花费几个小时，并在 `output\u002F\u003C?>` 文件夹中生成训练好的模型（包括检查点和 TFHub 模块）、实验结果（JSON 格式）以及可视化内容（包括 GIF 动画）。\n如果只想打印该模型的配置而不进行训练，可添加标志 `--only_print`。\n\n在训练完若干模型后，你可以通过运行以下命令汇总结果（在同一文件夹中）：\n\n```\ndlib_aggregate_results\n```\n\n这将创建一个 `results.json` 文件，包含所有汇总的结果。\n\n\n### 运行不同配置\ndisentanglement_lib 内部使用 [gin](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgin-config) 来配置超参数和其他设置。\n要训练提供的模型之一但使用不同的超参数，你需要编写一个 gin 配置文件，例如 `examples\u002Fmodel.gin`。\n然后，你可以使用以下命令：\n\n```\ndlib_train --gin_config=examples\u002Fmodel.gin --model_dir=\u003C模型输出目录>\n```\n\n来训练模型，其中 `--model_dir` 指定保存结果的路径。\n\n要按照论文《挑战解纠缠表征无监督学习中的常见假设》中的评估协议评估新训练的模型，只需运行：\n\n```\ndlib_reproduce --model_dir=\u003C模型输出目录> --output_directory=\u003C输出目录>\n```\n\n同样，如果你想自定义表征的提取和评估方式，也可以查看 `dlib_postprocess` 和 `dlib_evaluate`。\n\n### 开始你自己的研究\ndisentanglement_lib 易于扩展，可用于实现与解纠缠表征相关的新型模型和指标。\n要开始，只需浏览 `examples\u002Fexample.py`，它向你展示了如何创建自己的解纠缠模型和指标，以及如何将其与现有模型和指标进行基准测试。\n\n## 预训练的disentanglement_lib模块\n重现研究[*挑战无监督学习中解纠缠表征的常见假设*](https:\u002F\u002Farxiv.org\u002Fabs\u002F1811.12359)中的全部12,600个模型需要大量的计算资源。\n为了促进进一步的研究，**disentanglement_lib包含10,800个预训练的disentanglement_lib模块**，这些模块对应于使用`dlib_reproduce`并指定`--model_num=\u003C?>`在0到10,799之间运行的结果（其他模型对应于未公开发布的Shapes3D）。\n每个disentanglement_lib模块包含训练好的模型（以TFHub模块的形式）、提取的表征（同样以TFHub模块的形式），以及记录的实验结果，例如不同的解纠缠分数（以JSON格式存储）。\n这使得新模型与预训练模型的比较变得简单，并且能够在预训练模型集合上计算新的解纠缠指标。\n\n要访问这10,800个预训练的disentanglement_lib模块，您可以使用以下链接下载单个模块：\n\n```\nhttps:\u002F\u002Fstorage.googleapis.com\u002Fdisentanglement_lib\u002Funsupervised_study_v1\u002F\u003C?>.zip\n```\n其中`\u003C?>`对应于0到10,799之间的模型索引（[示例](https:\u002F\u002Fstorage.googleapis.com\u002Fdisentanglement_lib\u002Funsupervised_study_v1\u002F0.zip)）。\n\n存储桶中的每个ZIP文件对应于使用该模型编号运行一次`dlib_reproduce`的结果。\n要了解更多关于所用配置设置的信息，请查看`disentanglement_lib\u002Fconfig\u002Funsupervised_study_v1\u002Fsweep.py`中的代码，或者运行：\n\n```\ndlib_reproduce --model_num=\u003C?> --only_print\n```\n\n## 常见问题\n\n### 如何为我的模型制作精美的GIF动画？\n如果您运行`dlib_reproduce`，它们会自动保存到输出目录的`visualizations`子文件夹中。否则，您可以使用脚本`dlib_visualize_dataset`生成这些动画，或调用`disentanglement_lib\u002Fvisualize\u002Fvisualize_model.py`中的函数`visualize(...)`。\n\n### 结果和模型是如何保存的？\n在每个主要步骤（训练\u002F后处理\u002F评估）完成后，都会创建一个输出目录。\n对于所有步骤，都有一个`results`文件夹，其中包含该步骤之前的所有配置设置和实验结果。\n`gin`子文件夹包含以gin格式存储的每一步的运行配置。\n`json`子文件夹包含以JSON格式存储的运行配置和该步骤的实验结果。\n最后，`aggregate`子文件夹包含聚合的JSON文件，每个文件同时包含所有先前步骤的配置和结果。\n\n训练步骤还会额外保存TensorFlow检查点（存放在`tf_checkpoint`子文件夹中）和训练好的模型作为TFHub模块（存放在`tfhub`子文件夹中）。类似地，后处理步骤会将表征函数保存为TFHub模块（存放在`tfhub`子文件夹中）。\n如果您运行`dlib_reproduce`，它会为所有您运行过的不同子步骤创建子文件夹。特别是，它会为每个您计算的指标创建一个输出目录。\n\n### 如何访问结果？\n\n要访问结果，首先使用`dlib_aggregate_results`聚合所有结果，指定一个能匹配所有结果文件的glob模式。\n例如，在使用`dlib_reproduce`训练几个不同模型后，您可以指定：\n\n```\ndlib_aggregate --output_path=\u003C...>.json \\\n  --result_file_pattern=\u003C...>\u002F*\u002Fmetrics\u002F*\u002F*\u002Fresults\u002Faggregate\u002Fevaluation.json\n```\nglob模式中的第一个*会匹配不同的模型，第二个*匹配不同的表征，最后一个*匹配不同的指标。\n最后，您可以这样访问聚合后的结果：\n\n```python\nfrom disentanglement_lib.utils import aggregate_results\ndf = aggregate_results.load_aggregated_json_results(output_path)\n```\n\n## 在代码中应该查找什么？\n\n以下是对整体代码结构的指南：\n\n**(1) 训练步骤：**\n\n* `disentanglement_lib\u002Fmethods\u002Funsupervised`：\n包含训练协议（`train.py`）以及所有用于训练方法的模型函数（`vae.py`）。这些方法都继承自`GaussianEncoderModel`类。\n* `disentanglement_lib\u002Fmethods\u002Fshared`：\n包含不同模型中共享的架构、损失和优化器。\n\n**(2) 后处理步骤：**\n\n* `disentanglement_lib\u002Fpostprocess`：\n包含后处理流程（`postprocess.py`）以及两种提取方法（`methods.py`）。\n\n**(3) 评估步骤：**\n\n* `disentanglement_lib\u002Fevaluation`：包含评估协议（`evaluate.py`）。\n\n* `disentanglement_lib\u002Fevaluation\u002Fmetrics`：包含不同解纠缠指标的实现。\n\n**超参数和配置文件：**\n\n* `disentanglement_lib\u002Fconfig\u002Funsupervised_study_v1`：\n包含不同步骤的gin配置文件（`*.gin`），以及论文[*挑战无监督学习中解纠缠表征的常见假设*]中实验的超参数扫描（`sweep.py`）。\n\n**共享功能：**\n\n* `bin`：用于运行不同流程、可视化数据集和模型，以及聚合结果的脚本。\n\n* `disentanglement_lib\u002Fdata\u002Fground_truth`：\n包含生成数据的所有脚本。所有数据集（在`named_data.py`中）都是`GroundTruthData`类的实例。\n\n* `disentanglement_lib\u002Futils`：\n包含帮助函数，用于聚合和保存流程结果以及训练好的模型。\n\n* `disentanglement_lib\u002Fvisualize`：\n包含用于数据集和训练模型的可视化函数。\n\n## NeurIPS 2019解纠缠挑战\n\n该库也用于[NeurIPS 2019解纠缠挑战](https:\u002F\u002Fwww.aicrowd.com\u002Fchallenges\u002Fneurips-2019-disentanglement-challenge)。挑战包含三个不同的数据集。\n1. 简单的渲染图像（[mpi3d_toy](https:\u002F\u002Fstorage.googleapis.com\u002Fdisentanglement_dataset\u002Fdata_npz\u002Fsim_toy_64x_ordered_without_heldout_factors.npz)）\n2. 真实的渲染图像（mpi3d_realistic）：_尚未发布_\n3. 真实世界图像（mpi3d_real）：_尚未发布_\n\n目前，只有简单的渲染数据集是公开可用的，运行以下命令即可自动下载：\n\n```\ndlib_download_data\n```\n其他数据集将在比赛的后期阶段提供。更多关于比赛的信息，请访问[比赛网站](https:\u002F\u002Fwww.aicrowd.com\u002Fchallenges\u002Fneurips-2019-disentanglement-challenge)。有关数据集的更多信息，请参阅[这里](https:\u002F\u002Fgithub.com\u002Frr-learning\u002Fdisentanglement_dataset)或arXiv预印本[关于从仿真到真实世界的归纳偏置迁移：一个新的解纠缠数据集](https:\u002F\u002Farxiv.org\u002Fabs\u002F1906.03292)。\n\n## 抽象推理实验\n\n该库还包含用于以下论文实验的代码，位于`disentanglement_lib\u002Fevaluation\u002Fabstract_reasoning`子目录中：\n> [**解纠缠表征对抽象视觉推理有帮助吗？**](https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.12506)\n> *Sjoerd van Steenkiste、Francesco Locatello、Jürgen Schmidhuber、Olivier Bachem*。NeurIPS，2019年。\n\n实验方案分为两部分：\n首先，要训练解纠缠模型，可以使用标准的复现流程（`dlib_reproduce`），例如通过以下命令：\n\n```\ndlib_reproduce --model_num=\u003C?> --study=abstract_reasoning_study_v1\n```\n其中`\u003C?>`应替换为0到359之间的模型索引，\n对应于要训练的模型ID。\n\n其次，要训练抽象推理模型，可以使用自动安装的流程`dlib_reason`。\n要配置模型，请根据需要复制并修改`disentanglement_lib\u002Fconfig\u002Fabstract_reasoning_study_v1\u002Fstage2\u002Fexample.gin`。\n然后，使用以下命令来训练和评估一个抽象推理模型：\n\n```\ndlib_reason --gin_config=\u003C?> --input_dir=\u003C?> --output_dir=\u003C?>\n```\n结果将保存在输出目录的`results`子目录中。\n\n## 公平性实验\n\n该库还包含用于以下论文实验的代码，位于`disentanglement_lib\u002Fevaluation\u002Fmetrics\u002Ffairness.py`：\n> [**解纠缠表征的公平性研究**](https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.13662)\n> *Francesco Locatello、Gabriele Abbati、Tom Rainforth、Stefan Bauer、Bernhard Schoelkopf、Olivier Bachem*。NeurIPS，2019年。\n\n要训练和评估所有模型，只需使用以下命令：\n\n```\ndlib_reproduce --model_num=\u003C?> --study=fairness_study_v1\n```\n其中`\u003C?>`应替换为0到12,599之间的模型索引，\n对应于要训练的模型ID。\n\n如果您只想使用论文中的评估协议重新评估已训练的模型，可以使用以下命令：\n\n```\ndlib_reproduce --model_dir=\u003Cmodel_output_directory> --output_directory=\u003Coutput> --study=fairness_study_v1\n```\n\n## UDR实验\n\n该库还包含用于以下论文提出的无监督解纠缠排名（UDR）方法的代码，位于`disentanglement_lib\u002Fbin\u002Fdlib_udr`：\n> [**变分解纠缠表征学习的无监督模型选择**](https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.12614)\n> *Sunny Duan、Loic Matthey、Andre Saraiva、Nicholas Watters、Christopher P. Burgess、Alexander Lerchner、Irina Higgins*。\n\nUDR可用于新训练的模型（例如通过运行`dlib_reproduce`获得的模型）或现有的预训练模型。模型训练完成后，可以通过以下命令计算其UDR分数：\n\n```\ndlib_udr --model_dirs=\u003Cmodel_output_directory1>,\u003Cmodel_output_directory2> \\\n  --output_directory=\u003Coutput>\n```\n\n分数将导出到`\u003Coutput>\u002Fresults\u002Faggregate\u002Fevaluation.json`，存储在`model_scores`属性下。分数将按照输入模型目录的顺序呈现。\n\n## 弱监督实验\n该库还包含用于以下论文提出的弱监督解纠缠方法的代码，位于`disentanglement_lib\u002Fbin\u002Fdlib_reproduce_weakly_supervised`：\n> [**无需妥协的弱监督解纠缠**](https:\u002F\u002Farxiv.org\u002Fabs\u002F2002.02886)\n> *Francesco Locatello、Ben Poole、Gunnar Rätsch、Bernhard Schölkopf、Olivier Bachem、Michael Tschannen*。\n\n```\ndlib_reproduce_weakly_supervised --output_directory=\u003Coutput> \\\n   --gin_model_config_dir=\u003Cdir> \\\n   --gin_model_config_name=\u003Cname> \\\n   --gin_postprocess_config_glob=\u003Cpostprocess_configs> \\\n   --gin_evaluation_config_glob=\u003Ceval_configs> \\\n   --pipeline_seed=\u003Cseed>\n```\n\n## 半监督实验\n该库还包含用于以下论文提出的半监督解纠缠方法的代码，位于`disentanglement_lib\u002Fbin\u002Fdlib_reproduce_semi_supervised`：\n> [**利用少量标签解纠缠变化因素**](https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.01258)\n> *Francesco Locatello、Michael Tschannen、Stefan Bauer、Gunnar Rätsch、Bernhard Schölkopf、Olivier Bachem*。\n\n```\ndlib_reproduce_weakly_supervised --output_directory=\u003Coutput> \\\n   --gin_model_config_dir=\u003Cdir> \\\n   --gin_model_config_name=\u003Cname> \\\n   --gin_postprocess_config_glob=\u003Cpostprocess_configs> \\\n   --gin_evaluation_config_glob=\u003Ceval_configs> \\\n   --gin_validation_config_glob=\u003Cval_configs> \\\n   --pipeline_seed=\u003Cseed> \\\n   --eval_seed=\u003Cseed> \\\n   --supervised_seed=\u003Cseed> \\\n   --num_labelled_samples=\u003Cnum> \\\n   --train_percentage=0.9 \\\n   --labeller_fn=\"@perfect_labeller\"\n```\n\n## 反馈\n请将任何反馈发送至bachem@google.com和francesco.locatello@tuebingen.mpg.de。\n\n## 引用\n如果您使用**disentanglement_lib**，请考虑引用：\n\n```\n@inproceedings{locatello2019challenging,\n  title={挑战无监督解纠缠表征学习中的常见假设},\n  author={Locatello, Francesco and Bauer, Stefan and Lucic, Mario and Raetsch, Gunnar and Gelly, Sylvain and Sch{\\\"o}lkopf, Bernhard and Bachem, Olivier},\n  booktitle={国际机器学习大会},\n  pages={4114--4124},\n  year={2019}\n}\n```\n\n### 这并非谷歌官方支持的产品。","# disentanglement_lib 中文快速上手指南\n\n## 环境准备\n\n- **系统要求**：Linux 系统（推荐使用 Google Cloud Deep Learning VM 或 Ubuntu 20.04+）\n- **Python 版本**：Python 3.7+\n- **前置依赖**：TensorFlow（GPU 或 CPU 版）、NumPy、SciPy、scikit-learn、TFHub、Gin-config\n\n> 💡 **国内用户建议**：使用清华镜像加速 pip 安装  \n> 在 `pip install` 命令前添加 `-i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple`\n\n## 安装步骤\n\n1. 克隆仓库：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fdisentanglement_lib.git\ncd disentanglement_lib\n```\n\n2. 安装依赖（推荐使用 GPU 版本）：\n\n```bash\npip install .[tf_gpu] -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n> 若无 GPU，使用：`pip install .[tf]`\n\n3. 验证安装：\n\n```bash\ndlib_tests\n```\n\n4. 下载数据集（自动下载 dSprites、Color-dSprites、Noisy-dSprites、SmallNORB、Cars3D）：\n\n```bash\ndlib_download_data\n```\n\n5. （可选）设置数据路径环境变量，避免每次手动指定：\n\n```bash\nexport DISENTANGLEMENT_LIB_DATA=\u003C你的数据目录路径>\n```\n\n> 将上述命令添加至 `~\u002F.bashrc` 以永久生效。\n\n## 基本使用\n\n### 最简示例：复现一个预设模型\n\n运行以下命令，训练并评估第 0 号模型（约数小时）：\n\n```bash\ndlib_reproduce --model_num=0\n```\n\n训练完成后，结果将保存在 `output\u002F0\u002F` 目录中，包含：\n- 训练模型（TFHub 模块）\n- 评估指标（JSON 格式）\n- 可视化 GIF（在 `visualizations\u002F` 子目录）\n\n### 查看模型配置（不训练）\n\n如仅想查看配置而不训练：\n\n```bash\ndlib_reproduce --model_num=0 --only_print\n```\n\n### 聚合所有实验结果\n\n训练多个模型后，聚合所有结果为一个 JSON 文件：\n\n```bash\ndlib_aggregate_results\n```\n\n生成的 `results.json` 可用 Pandas 加载分析：\n\n```python\nfrom disentanglement_lib.utils import aggregate_results\ndf = aggregate_results.load_aggregated_json_results(\"results.json\")\nprint(df.head())\n```\n\n> ✅ 推荐：首次使用建议从 `--model_num=0` 开始，快速验证环境是否正常。","一位机器学习研究员在一家自动驾驶初创公司负责开发视觉感知系统，目标是从车载摄像头的复杂场景中自动分离出车辆、行人、道路标志等独立语义因子，以提升目标检测的鲁棒性。传统方法依赖人工标注和多模型集成，效率低且难以泛化。\n\n### 没有 disentanglement_lib 时\n- 需要从零实现多个变分自编码器（如BetaVAE、FactorVAE），耗费数周时间调试训练流程。\n- 缺乏标准化评估指标，无法量化表示是否真正“解耦”，只能靠主观观察中间特征图判断效果。\n- 不同数据集（如dSprites、Cars3D）的预处理代码重复编写，难以复用，导致实验周期拉长。\n- 没有现成的预训练模型可参考，每次实验都需从头训练，GPU资源浪费严重。\n- 实验结果分散在多个文件夹和格式中，无法统一分析，团队协作和论文复现困难。\n\n### 使用 disentanglement_lib 后\n- 通过一行命令 `dlib_reproduce --model_num=42` 快速复现论文中已验证的模型，3小时内完成训练与保存。\n- 自动计算MIG、SAP、DCI等7种解耦评分，直接生成数值报告，客观比较不同架构的性能差异。\n- 一键下载dSprites和SmallNORB等标准数据集，无需手动处理格式，节省近两周数据准备时间。\n- 使用10,800个预训练模型作为基线，快速筛选出最适合车载场景的编码结构，加速模型选型。\n- 所有实验配置、中间表示和可视化结果自动聚合为JSON，用Pandas一键生成对比图表，支持团队共享与论文投稿。\n\ndisentanglement_lib 让研究人员从重复工程中解放，专注在解耦表示的创新设计与实际场景适配上，将原本数月的探索周期压缩至数天。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fgoogle-research_disentanglement_lib_97924791.gif","google-research","Google Research","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fgoogle-research_c23b2adf.png","",null,"https:\u002F\u002Fresearch.google","https:\u002F\u002Fgithub.com\u002Fgoogle-research",[83,87],{"name":84,"color":85,"percentage":86},"Python","#3572A5",98.9,{"name":88,"color":89,"percentage":90},"Shell","#89e051",1.1,1422,204,"2026-03-25T01:55:15","Apache-2.0","Linux","推荐使用 NVIDIA GPU，显存 8GB+，CUDA 版本未明确说明，但需支持 TensorFlow GPU","16GB+",{"notes":99,"python":100,"dependencies":101},"建议设置 DISENTANGLEMENT_LIB_DATA 环境变量指向数据目录；首次运行需下载约 5GB 数据集；支持使用预训练模型（10,800 个）以节省训练时间；推荐在 Google Cloud Deep Learning VM 等 Linux 环境中运行；不支持 Windows 系统","3",[102,103,104,105,106,107],"tensorflow","scipy","numpy","scikit-learn","tf-hub","gin-config",[14,13,51,54],"2026-03-27T02:49:30.150509","2026-04-06T07:13:19.520915",[112,117,122,127,132,137],{"id":113,"question_zh":114,"answer_zh":115,"source_url":116},9082,"是否考虑将项目升级到 TensorFlow 2 或 PyTorch？","已有用户创建了 PyTorch 版本，可访问 https:\u002F\u002Fgitee.com\u002Fmicrocloud\u002Fdisentanglement_lib 使用；同时有用户愿意贡献 TensorFlow 2 版本，建议联系维护者确认是否纳入官方路线图。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fdisentanglement_lib\u002Fissues\u002F32",{"id":118,"question_zh":119,"answer_zh":120,"source_url":121},9083,"安装时出现 TensorFlow 2.0 兼容性错误，如何解决？","可暂时降级 TensorFlow 和 tensorflow-probability 到旧版本以恢复功能，官方计划在下一版本中修复 setup.py 文件。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fdisentanglement_lib\u002Fissues\u002F17",{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},9084,"评估 Factor-VAE 指标时出现显存不足问题，如何解决？","已发布 v1.1 版本修复该问题，新版本会以批处理方式提取表示并拼接，避免一次性加载 10000x64x64x3 的大数据，建议升级到最新版本。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fdisentanglement_lib\u002Fissues\u002F11",{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},9085,"Factor-VAE 指标为何要求潜在表示维度必须等于潜在因子数量？","v1.1 中的断言限制已被移除，现在支持评估任意维度的潜在表示，无需强制匹配潜在因子数量，建议更新到最新版本以使用此修复。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fdisentanglement_lib\u002Fissues\u002F12",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},9086,"运行 pip install .[tf_gpu] 时出现 setuptools 版本不兼容警告，如何解决？","运行 pip install --upgrade setuptools 升级 setuptools 到 41.0.0 或更高版本即可解决该兼容性问题。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fdisentanglement_lib\u002Fissues\u002F20",{"id":138,"question_zh":139,"answer_zh":140,"source_url":141},9087,"FactorVAE 的判别器损失函数是否写反了？","没有错误，虽然代码中计算的是 discr_loss，但实际最小化的是 -discr_loss，因此逻辑正确，无需修改。","https:\u002F\u002Fgithub.com\u002Fgoogle-research\u002Fdisentanglement_lib\u002Fissues\u002F16",[143,148,153,158],{"id":144,"version":145,"summary_zh":146,"released_at":147},106531,"v1.4","This adds code for the Unsupervised Disentanglement Ranking (UDR) method.","2019-11-20T17:36:18",{"id":149,"version":150,"summary_zh":151,"released_at":152},106532,"v1.3","This adds various bug fixes, a new fairness score and code to run abstract reasoning experiments.","2019-10-29T16:02:42",{"id":154,"version":155,"summary_zh":156,"released_at":157},106533,"v1.2","This fixes a bug in the FactorVAE score computation.","2019-07-22T22:51:28",{"id":159,"version":160,"summary_zh":161,"released_at":162},106534,"v1.0","This is the version used for the NeurIPS 2019 Competition on Learning Disentangled Representations.","2019-06-27T15:25:55"]