[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-thuml--Transfer-Learning-Library":3,"tool-thuml--Transfer-Learning-Library":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":80,"owner_twitter":79,"owner_website":81,"owner_url":82,"languages":83,"stars":88,"forks":89,"last_commit_at":90,"license":91,"difficulty_score":23,"env_os":92,"env_gpu":93,"env_ram":92,"env_deps":94,"category_tags":99,"github_topics":100,"view_count":23,"oss_zip_url":79,"oss_zip_packed_at":79,"status":16,"created_at":112,"updated_at":113,"faqs":114,"releases":153},2926,"thuml\u002FTransfer-Learning-Library","Transfer-Learning-Library","Transfer Learning Library for Domain Adaptation, Task Adaptation, and Domain Generalization","Transfer-Learning-Library 是一个基于纯 PyTorch 构建的开源迁移学习库，专为领域自适应、任务自适应及领域泛化等场景设计。它旨在解决机器学习模型在新数据分布或新任务上表现不佳的难题，帮助开发者高效地将已有知识迁移到新场景中，从而减少对大量标注数据的依赖。\n\n该工具非常适合人工智能研究人员和算法工程师使用。其 API 设计风格与 torchvision 高度一致，代码简洁且文档完善，用户既能直接调用现有的经典算法，也能轻松在此基础上开发新的研究方法。库内集成了 DANN、DAN、JAN 等多种主流领域自适应算法，并全面支持图像分类、目标检测、语义分割等多种视觉任务。此外，它还涵盖了半监督学习和模型选择等实用功能，提供了丰富的示例代码以覆盖不同的学习设置。无论是希望快速复现论文成果的研究者，还是需要在实际项目中落地迁移学习技术的开发者，都能从中获得极大的便利。","\u003Cdiv align='center' margin-bottom:40px> \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthuml_Transfer-Learning-Library_readme_e71401d11b8f.png\" width=200\u002F> \u003C\u002Fdiv>\n\n# Transfer Learning Library\n\n- [Introduction](#introduction)\n- [Updates](#updates)\n- [Supported Methods](#supported-methods)\n- [Installation](#installation)\n- [Documentation](#documentation)\n- [Contact](#contact)\n- [Citation](#citation)\n\n## Update (2024-03-15)\n\nWe upload an offline version of documentation [here](\u002Fdocs\u002Fhtml.zip). You can download and unzip it to view the documentation.\n\n## Notice (2023-08-09)\n\nA note on broken dataset links can be found here: [DATASETS.md](DATASETS.md).\n\n## Introduction\n*TLlib* is an open-source and well-documented library for Transfer Learning. It is based on pure PyTorch with high performance and friendly API. Our code is pythonic, and the design is consistent with torchvision. You can easily develop new algorithms, or readily apply existing algorithms.\n\nOur _API_ is divided by methods, which include: \n- domain alignment methods (tllib.aligment)\n- domain translation methods (tllib.translation)\n- self-training methods (tllib.self_training)\n- regularization methods (tllib.regularization)\n- data reweighting\u002Fresampling methods (tllib.reweight)\n- model ranking\u002Fselection methods (tllib.ranking)\n- normalization-based methods (tllib.normalization)\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthuml_Transfer-Learning-Library_readme_2f2e08e48c31.png\">\n\nWe provide many example codes in the directory _examples_, which is divided by learning setups. Currently, the supported learning setups include:\n- DA (domain adaptation)\n- TA (task adaptation, also known as finetune)\n- OOD (out-of-distribution generalization, also known as DG \u002F domain generalization)\n- SSL (semi-supervised learning)\n- Model Selection \n\nOur supported tasks include: classification, regression, object detection, segmentation, keypoint detection, and so on.\n\n## Updates \n\n### 2022.9\n\nWe support installing *TLlib* via `pip`, which is experimental currently.\n\n```shell\npip install -i https:\u002F\u002Ftest.pypi.org\u002Fsimple\u002F tllib==0.4\n```\n\n### 2022.8\nWe release `v0.4` of *TLlib*. Previous versions of *TLlib* can be found [here](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTransfer-Learning-Library\u002Freleases). In `v0.4`, we add implementations of \nthe following methods:\n- Domain Adaptation for Object Detection [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fobject_detection) [[API]](\u002Ftllib\u002Falignment\u002Fd_adapt)\n- Pre-trained Model Selection [[Code]](\u002Fexamples\u002Fmodel_selection) [[API]](\u002Ftllib\u002Franking)\n- Semi-supervised Learning for Classification [[Code]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002F) [[API]](\u002Ftllib\u002Fself_training)\n\nBesides, we maintain a collection of **_awesome papers in Transfer Learning_** in another repo [_A Roadmap for Transfer Learning_](https:\u002F\u002Fgithub.com\u002Fthuml\u002FA-Roadmap-for-Transfer-Learning).\n\n### 2022.2\nWe adjusted our API following our survey [Transferablity in Deep Learning](https:\u002F\u002Farxiv.org\u002Fabs\u002F2201.05867).\n\n## Supported Methods\nThe currently supported algorithms include:\n\n##### Domain Adaptation for Classification [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification)\n- **DANN** - Unsupervised Domain Adaptation by Backpropagation [[ICML 2015]](http:\u002F\u002Fproceedings.mlr.press\u002Fv37\u002Fganin15.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fdann.py)\n- **DAN** - Learning Transferable Features with Deep Adaptation Networks [[ICML 2015]](http:\u002F\u002Fise.thss.tsinghua.edu.cn\u002F~mlong\u002Fdoc\u002Fdeep-adaptation-networks-icml15.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fdan.py)\n- **JAN** - Deep Transfer Learning with Joint Adaptation Networks [[ICML 2017]](http:\u002F\u002Fise.thss.tsinghua.edu.cn\u002F~mlong\u002Fdoc\u002Fjoint-adaptation-networks-icml17.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fjan.py)\n- **ADDA** - Adversarial Discriminative Domain Adaptation [[CVPR 2017]](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_cvpr_2017\u002Fpapers\u002FTzeng_Adversarial_Discriminative_Domain_CVPR_2017_paper.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fadda.py)\n- **CDAN** - Conditional Adversarial Domain Adaptation [[NIPS 2018]](http:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F7436-conditional-adversarial-domain-adaptation) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fcdan.py) \n- **MCD** - Maximum Classifier Discrepancy for Unsupervised Domain Adaptation [[CVPR 2018]](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_cvpr_2018\u002Fpapers\u002FSaito_Maximum_Classifier_Discrepancy_CVPR_2018_paper.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fmcd.py)\n- **MDD** - Bridging Theory and Algorithm for Domain Adaptation [[ICML 2019]](http:\u002F\u002Fproceedings.mlr.press\u002Fv97\u002Fzhang19i\u002Fzhang19i.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fmdd.py) \n- **BSP** - Transferability vs. Discriminability: Batch Spectral Penalization for Adversarial Domain Adaptation [[ICML 2019]](http:\u002F\u002Fproceedings.mlr.press\u002Fv97\u002Fchen19i\u002Fchen19i.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fbsp.py) \n- **MCC** - Minimum Class Confusion for Versatile Domain Adaptation [[ECCV 2020]](http:\u002F\u002Fwww.ecva.net\u002Fpapers\u002Feccv_2020\u002Fpapers_ECCV\u002Fpapers\u002F123660460.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fmcc.py)\n\n##### Domain Adaptation for Object Detection [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fobject_detection)\n- **CycleGAN** - Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks [[ICCV 2017]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ICCV_2017\u002Fpapers\u002FZhu_Unpaired_Image-To-Image_Translation_ICCV_2017_paper.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fobject_detection\u002Fcycle_gan.py)\n- **D-adapt** - Decoupled Adaptation for Cross-Domain Object Detection [[ICLR 2022]](https:\u002F\u002Fopenreview.net\u002Fpdf?id=VNqaB1g9393) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fobject_detection\u002Fd_adapt)\n\n##### Domain Adaptation for Semantic Segmentation [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fsemantic_segmentation\u002F)\n- **CycleGAN** - Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks [[ICCV 2017]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ICCV_2017\u002Fpapers\u002FZhu_Unpaired_Image-To-Image_Translation_ICCV_2017_paper.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fsemantic_segmentation\u002Fcycle_gan.py)\n- **CyCADA** - Cycle-Consistent Adversarial Domain Adaptation [[ICML 2018]](http:\u002F\u002Fproceedings.mlr.press\u002Fv80\u002Fhoffman18a.html) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fsemantic_segmentation\u002Fcycada.py)\n- **ADVENT** - Adversarial Entropy Minimization for Domain Adaptation in Semantic Segmentation [[CVPR 2019]](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_CVPR_2019\u002Fpapers\u002FVu_ADVENT_Adversarial_Entropy_Minimization_for_Domain_Adaptation_in_Semantic_Segmentation_CVPR_2019_paper.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fsemantic_segmentation\u002Fadvent.py)\n- **FDA** - Fourier Domain Adaptation for Semantic Segmentation [[CVPR 2020]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2004.05498) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fsemantic_segmentation\u002Ffda.py)\n\n##### Domain Adaptation for Keypoint Detection [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fkeypoint_detection)\n- **RegDA** - Regressive Domain Adaptation for Unsupervised Keypoint Detection [[CVPR 2021]](http:\u002F\u002Fise.thss.tsinghua.edu.cn\u002F~mlong\u002Fdoc\u002Fregressive-domain-adaptation-cvpr21.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fkeypoint_detection)\n\n##### Domain Adaptation for Person Re-identification [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fre_identification\u002F)\n- **IBN-Net** - Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net [[ECCV 2018]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ECCV_2018\u002Fpapers\u002FXingang_Pan_Two_at_Once_ECCV_2018_paper.pdf)\n- **MMT** - Mutual Mean-Teaching: Pseudo Label Refinery for Unsupervised Domain Adaptation on Person Re-identification [[ICLR 2020]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2001.01526) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fre_identification\u002Fmmt.py)\n- **SPGAN** - Similarity Preserving Generative Adversarial Network [[CVPR 2018]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1811.10551.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fre_identification\u002Fspgan.py)\n\n##### Partial Domain Adaptation [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fpartial_domain_adaptation)\n- **IWAN** - Importance Weighted Adversarial Nets for Partial Domain Adaptation[[CVPR 2018]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1803.09210) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fpartial_domain_adaptation\u002Fiwan.py)\n- **AFN** - Larger Norm More Transferable: An Adaptive Feature Norm Approach for\nUnsupervised Domain Adaptation [[ICCV 2019]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1811.07456v2.pdf) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fpartial_domain_adaptation\u002Fafn.py)\n\n##### Open-set Domain Adaptation [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fopenset_domain_adaptation)\n- **OSBP** - Open Set Domain Adaptation by Backpropagation [[ECCV 2018]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1804.10427) [[Code]](\u002Fexamples\u002Fdomain_adaptation\u002Fopenset_domain_adaptation\u002Fosbp.py)\n\n##### Domain Generalization for Classification [[Code]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002F)\n- **IBN-Net** - Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net [[ECCV 2018]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ECCV_2018\u002Fpapers\u002FXingang_Pan_Two_at_Once_ECCV_2018_paper.pdf)\n- **MixStyle** - Domain Generalization with MixStyle [[ICLR 2021]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2104.02008) [[Code]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002Fmixstyle.py)\n- **MLDG** - Learning to Generalize: Meta-Learning for Domain Generalization [[AAAI 2018]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1710.03463.pdf) [[Code]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002Fmldg.py)\n- **IRM** - Invariant Risk Minimization [[ArXiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1907.02893) [[Code]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002Firm.py)\n- **VREx** - Out-of-Distribution Generalization via Risk Extrapolation [[ICML 2021]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2003.00688) [[Code]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002Fvrex.py)\n- **GroupDRO** - Distributionally Robust Neural Networks for Group Shifts: On the Importance of Regularization for Worst-Case Generalization [[ArXiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1911.08731) [[Code]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002Fgroupdro.py)\n- **Deep CORAL** - Correlation Alignment for Deep Domain Adaptation [[ECCV 2016]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1607.01719) [[Code]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002Fcoral.py)\n\n##### Domain Generalization for Person Re-identification [[Code]](\u002Fexamples\u002Fdomain_generalization\u002Fre_identification\u002F)\n- **IBN-Net** - Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net [[ECCV 2018]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ECCV_2018\u002Fpapers\u002FXingang_Pan_Two_at_Once_ECCV_2018_paper.pdf)\n- **MixStyle** - Domain Generalization with MixStyle [[ICLR 2021]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2104.02008) [[Code]](\u002Fexamples\u002Fdomain_generalization\u002Fre_identification\u002Fmixstyle.py)\n\n##### Task Adaptation (Fine-Tuning) for Image Classification [[Code]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002F)\n- **L2-SP** - Explicit inductive bias for transfer learning with convolutional networks [[ICML 2018]]((https:\u002F\u002Farxiv.org\u002Fabs\u002F1802.01483)) [[Code]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Fdelta.py)\n- **BSS** - Catastrophic Forgetting Meets Negative Transfer: Batch Spectral Shrinkage for Safe Transfer Learning [[NIPS 2019]](https:\u002F\u002Fproceedings.neurips.cc\u002Fpaper\u002F2019\u002Ffile\u002Fc6bff625bdb0393992c9d4db0c6bbe45-Paper.pdf) [[Code]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Fbss.py)\n- **DELTA** - DEep Learning Transfer using Fea- ture Map with Attention for convolutional networks [[ICLR 2019]](https:\u002F\u002Fopenreview.net\u002Fpdf?id=rkgbwsAcYm) [[Code]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Fdelta.py)\n- **Co-Tuning** - Co-Tuning for Transfer Learning [[NIPS 2020]](http:\u002F\u002Fise.thss.tsinghua.edu.cn\u002F~mlong\u002Fdoc\u002Fco-tuning-for-transfer-learning-nips20.pdf) [[Code]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Fco_tuning.py)\n- **StochNorm** - Stochastic Normalization [[NIPS 2020]](https:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F2020\u002Ffile\u002Fbc573864331a9e42e4511de6f678aa83-Paper.pdf) [[Code]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Fstochnorm.py)\n- **LWF** - Learning Without Forgetting [[ECCV 2016]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1606.09282) [[Code]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Flwf.py)\n- **Bi-Tuning** - Bi-tuning of Pre-trained Representations [[ArXiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2011.06182?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+arxiv%2FQSXk+%28ExcitingAds%21+cs+updates+on+arXiv.org%29) [[Code]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Fbi_tuning.py)\n\n##### Pre-trained Model Selection [[Code]](\u002Fexamples\u002Fmodel_selection)\n\n- **H-Score** - An Information-theoretic Approach to Transferability in Task Transfer Learning [[ICIP 2019]](http:\u002F\u002Fyangli-feasibility.com\u002Fhome\u002Fmedia\u002Ficip-19.pdf) [[Code]](\u002Fexamples\u002Fmodel_selection\u002Fhscore.py)\n- **NCE** - Negative Conditional Entropy in `Transferability and Hardness of Supervised Classification Tasks [[ICCV 2019]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1908.08142v1.pdf) [[Code]](\u002Fexamples\u002Fmodel_selection\u002Fnce.py)\n- **LEEP** - LEEP: A New Measure to Evaluate Transferability of Learned Representations [[ICML 2020]](http:\u002F\u002Fproceedings.mlr.press\u002Fv119\u002Fnguyen20b\u002Fnguyen20b.pdf) [[Code]](\u002Fexamples\u002Fmodel_selection\u002Fleep.py)\n- **LogME** - Log Maximum Evidence in `LogME: Practical Assessment of Pre-trained Models for Transfer Learning [[ICML 2021]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2102.11005.pdf) [[Code]](\u002Fexamples\u002Fmodel_selection\u002Flogme.py)\n\n##### Semi-Supervised Learning for Classification [[Code]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002F)\n- **Pseudo Label** - Pseudo-Label : The Simple and Efficient Semi-Supervised Learning Method for Deep Neural Networks [[ICML 2013]](http:\u002F\u002Fciteseerx.ist.psu.edu\u002Fviewdoc\u002Fdownload?doi=10.1.1.664.3543&rep=rep1&type=pdf) [[Code]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fpseudo_label.py)\n- **Pi Model** - Temporal Ensembling for Semi-Supervised Learning [[ICLR 2017]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1610.02242) [[Code]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fpi_model.py)\n- **Mean Teacher** - Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results [[NIPS 2017]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1703.01780) [[Code]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fmean_teacher.py)\n- **Noisy Student** - Self-Training With Noisy Student Improves ImageNet Classification [[CVPR 2020]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_CVPR_2020\u002Fpapers\u002FXie_Self-Training_With_Noisy_Student_Improves_ImageNet_Classification_CVPR_2020_paper.pdf) [[Code]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fnoisy_student.py)\n- **UDA** - Unsupervised Data Augmentation for Consistency Training [[NIPS 2020]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1904.12848v4.pdf) [[Code]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fuda.py)\n- **FixMatch** - Simplifying Semi-Supervised Learning with Consistency and Confidence [[NIPS 2020]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2001.07685) [[Code]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Ffixmatch.py)\n- **Self-Tuning** - Self-Tuning for Data-Efficient Deep Learning [[ICML 2021]](http:\u002F\u002Fise.thss.tsinghua.edu.cn\u002F~mlong\u002Fdoc\u002FSelf-Tuning-for-Data-Efficient-Deep-Learning-icml21.pdf) [[Code]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fself_tuning.py)\n- **FlexMatch** - FlexMatch: Boosting Semi-Supervised Learning with Curriculum Pseudo Labeling [[NIPS 2021]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2110.08263) [[Code]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fflexmatch.py)\n- **DebiasMatch** - Debiased Learning From Naturally Imbalanced Pseudo-Labels [[CVPR 2022]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent\u002FCVPR2022\u002Fpapers\u002FWang_Debiased_Learning_From_Naturally_Imbalanced_Pseudo-Labels_CVPR_2022_paper.pdf) [[Code]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fdebiasmatch.py)\n- **DST** - Debiased Self-Training for Semi-Supervised Learning [[NIPS 2022 Oral]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2202.07136) [[Code]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fdst.py)\n\n## Installation\n\n##### Install from Source Code\n\n- Please git clone the library first. Then, run the following commands to install `tllib` and all the dependency.\n```shell\npython setup.py install\npip install -r requirements.txt\n```\n##### Install via `pip`\n\n- Installing via `pip` is currently experimental.\n\n```shell\npip install -i https:\u002F\u002Ftest.pypi.org\u002Fsimple\u002F tllib==0.4\n```\n\n\n## Documentation\nYou can find the API documentation on the website: [Documentation](http:\u002F\u002Ftl.thuml.ai\u002F).\n\n## Usage\nYou can find examples in the directory `examples`. A typical usage is \n```shell script\n# Train a DANN on Office-31 Amazon -> Webcam task using ResNet 50.\n# Assume you have put the datasets under the path `data\u002Foffice-31`, \n# or you are glad to download the datasets automatically from the Internet to this path\npython dann.py data\u002Foffice31 -d Office31 -s A -t W -a resnet50  --epochs 20\n```\n\n## Contributing\nWe appreciate all contributions. If you are planning to contribute back bug-fixes, please do so without any further discussion. If you plan to contribute new features, utility functions or extensions, please first open an issue and discuss the feature with us. \n\n## Disclaimer on Datasets\n\nThis is a utility library that downloads and prepares public datasets. We do not host or distribute these datasets, vouch for their quality or fairness, or claim that you have licenses to use the dataset. It is your responsibility to determine whether you have permission to use the dataset under the dataset's license.\n\nIf you're a dataset owner and wish to update any part of it (description, citation, etc.), or do not want your dataset to be included in this library, please get in touch through a GitHub issue. Thanks for your contribution to the ML community!\n\n\n## Contact\nIf you have any problem with our code or have some suggestions, including the future feature, feel free to contact \n- Baixu Chen (cbx_99_hasta@outlook.com)\n- Junguang Jiang (JiangJunguang1123@outlook.com)\n- Mingsheng Long (longmingsheng@gmail.com)\n\nor describe it in Issues.\n\nFor Q&A in Chinese, you can choose to ask questions here before sending an email. [迁移学习算法库答疑专区](https:\u002F\u002Fzhuanlan.zhihu.com\u002Fp\u002F248104070)\n\n## Citation\n\nIf you use this toolbox or benchmark in your research, please cite this project. \n\n```latex\n@misc{jiang2022transferability,\n      title={Transferability in Deep Learning: A Survey}, \n      author={Junguang Jiang and Yang Shu and Jianmin Wang and Mingsheng Long},\n      year={2022},\n      eprint={2201.05867},\n      archivePrefix={arXiv},\n      primaryClass={cs.LG}\n}\n\n@misc{tllib,\n    author = {Junguang Jiang, Baixu Chen, Bo Fu, Mingsheng Long},\n    title = {Transfer-Learning-library},\n    year = {2020},\n    publisher = {GitHub},\n    journal = {GitHub repository},\n    howpublished = {\\url{https:\u002F\u002Fgithub.com\u002Fthuml\u002FTransfer-Learning-Library}},\n}\n```\n\n## Acknowledgment\n\nWe would like to thank School of Software, Tsinghua University and The National Engineering Laboratory for Big Data Software for providing such an excellent ML research platform.\n\n","\u003Cdiv align='center' margin-bottom:40px> \u003Cimg src=https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthuml_Transfer-Learning-Library_readme_e71401d11b8f.png width=200\u002F> \u003C\u002Fdiv>\n\n# 迁移学习库\n\n- [简介](#introduction)\n- [更新](#updates)\n- [支持的方法](#supported-methods)\n- [安装](#installation)\n- [文档](#documentation)\n- [联系方式](#contact)\n- [引用](#citation)\n\n## 更新 (2024-03-15)\n\n我们在此上传了文档的离线版本 [这里](\u002Fdocs\u002Fhtml.zip)。您可以下载并解压以查看文档。\n\n## 注意 (2023-08-09)\n\n关于数据集链接失效的说明，请参阅：[DATASETS.md](DATASETS.md)。\n\n## 简介\n*TLlib* 是一个开源且文档完善的迁移学习库。它基于纯 PyTorch 构建，具有高性能和友好的 API。我们的代码风格符合 Python 习惯，设计与 torchvision 保持一致。您可以轻松开发新算法，也可以直接应用现有的算法。\n\n我们的 _API_ 按方法划分，包括：\n- 域对齐方法 (tllib.aligment)\n- 域转换方法 (tllib.translation)\n- 自训练方法 (tllib.self_training)\n- 正则化方法 (tllib.regularization)\n- 数据重加权\u002F重采样方法 (tllib.reweight)\n- 模型排序\u002F选择方法 (tllib.ranking)\n- 基于归一化的方法 (tllib.normalization)\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthuml_Transfer-Learning-Library_readme_2f2e08e48c31.png\">\n\n我们在 _examples_ 目录中提供了许多示例代码，这些代码按学习设置分类。目前支持的学习设置包括：\n- DA（领域适应）\n- TA（任务适应，也称为微调）\n- OOD（分布外泛化，也称为 DG \u002F 领域泛化）\n- SSL（半监督学习）\n- 模型选择\n\n我们支持的任务包括：分类、回归、目标检测、分割、关键点检测等。\n\n## 更新\n\n### 2022.9\n\n我们现在支持通过 `pip` 安装 *TLlib*，目前仍处于实验阶段。\n\n```shell\npip install -i https:\u002F\u002Ftest.pypi.org\u002Fsimple\u002F tllib==0.4\n```\n\n### 2022.8\n我们发布了 *TLlib* 的 `v0.4` 版本。之前的版本可以在 [这里](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTransfer-Learning-Library\u002Freleases) 找到。在 `v0.4` 中，我们新增了以下方法的实现：\n- 目标检测领域的领域适应 [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fobject_detection) [[API]](\u002Ftllib\u002Falignment\u002Fd_adapt)\n- 预训练模型选择 [[代码]](\u002Fexamples\u002Fmodel_selection) [[API]](\u002Ftllib\u002Franking)\n- 分类任务的半监督学习 [[代码]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002F) [[API]](\u002Ftllib\u002Fself_training)\n\n此外，我们在另一个仓库 [_A Roadmap for Transfer Learning_](https:\u002F\u002Fgithub.com\u002Fthuml\u002FA-Roadmap-for-Transfer-Learning) 中维护了一个 **_迁移学习领域的优秀论文合集_**。\n\n### 2022.2\n我们根据我们的综述文章 [深度学习中的可迁移性](https:\u002F\u002Farxiv.org\u002Fabs\u002F2201.05867) 调整了我们的 API。\n\n## 支持的方法\n目前支持的算法包括：\n\n##### 分类任务的领域适应 [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification)\n- **DANN** - 通过反向传播实现的无监督领域适应 [[ICML 2015]](http:\u002F\u002Fproceedings.mlr.press\u002Fv37\u002Fganin15.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fdann.py)\n- **DAN** - 使用深度适应网络学习可迁移特征 [[ICML 2015]](http:\u002F\u002Fise.thss.tsinghua.edu.cn\u002F~mlong\u002Fdoc\u002Fdeep-adaptation-networks-icml15.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fdan.py)\n- **JAN** - 使用联合适应网络进行深度迁移学习 [[ICML 2017]](http:\u002F\u002Fise.thss.tsinghua.edu.cn\u002F~mlong\u002Fdoc\u002Fjoint-adaptation-networks-icml17.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fjan.py)\n- **ADDA** - 对抗式判别性领域适应 [[CVPR 2017]](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_cvpr_2017\u002Fpapers\u002FTzeng_Adversarial_Discriminative_Domain_CVPR_2017_paper.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fadda.py)\n- **CDAN** - 条件对抗式领域适应 [[NIPS 2018]](http:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F7436-conditional-adversarial-domain-adaptation) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fcdan.py) \n- **MCD** - 最大分类器差异用于无监督领域适应 [[CVPR 2018]](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_cvpr_2018\u002Fpapers\u002FSaito_Maximum_Classifier_Discrepancy_CVPR_2018_paper.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fmcd.py)\n- **MDD** - 沟通领域适应的理论与算法 [[ICML 2019]](http:\u002F\u002Fproceedings.mlr.press\u002Fv97\u002Fzhang19i\u002Fzhang19i.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fmdd.py) \n- **BSP** - 可迁移性 vs. 辨识能力：用于对抗式领域适应的批处理谱惩罚 [[ICML 2019]](http:\u002F\u002Fproceedings.mlr.press\u002Fv97\u002Fchen19i\u002Fchen19i.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fbsp.py) \n- **MCC** - 最小类别混淆用于多功能领域适应 [[ECCV 2020]](http:\u002F\u002Fwww.ecva.net\u002Fpapers\u002Feccv_2020\u002Fpapers_ECCV\u002Fpapers\u002F123660460.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fimage_classification\u002Fmcc.py)\n\n##### 目标检测领域的领域适应 [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fobject_detection)\n- **CycleGAN** - 使用循环一致性对抗网络进行无配对图像到图像的转换 [[ICCV 2017]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ICCV_2017\u002Fpapers\u002FZhu_Unpaired_Image-To-Image_Translation_ICCV_2017_paper.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fobject_detection\u002Fcycle_gan.py)\n- **D-adapt** - 用于跨域目标检测的解耦适应 [[ICLR 2022]](https:\u002F\u002Fopenreview.net\u002Fpdf?id=VNqaB1g9393) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fobject_detection\u002Fd_adapt)\n\n##### 语义分割领域的领域适应 [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fsemantic_segmentation\u002F)\n- **CycleGAN** - 使用循环一致性对抗网络进行无配对图像到图像的转换 [[ICCV 2017]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ICCV_2017\u002Fpapers\u002FZhu_Unpaired_Image-To-Image_Translation_ICCV_2017_paper.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fsemantic_segmentation\u002Fcycle_gan.py)\n- **CyCADA** - 循环一致性的对抗式领域适应 [[ICML 2018]](http:\u002F\u002Fproceedings.mlr.press\u002Fv80\u002Fhoffman18a.html) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fsemantic_segmentation\u002Fcycada.py)\n- **ADVENT** - 语义分割领域适应中的对抗式熵最小化 [[CVPR 2019]](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_CVPR_2019\u002Fpapers\u002FVu_ADVENT_Adversarial_Entropy_Minimization_for_Domain_Adaptation_in_Semantic_Segmentation_CVPR_2019_paper.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fsemantic_segmentation\u002Fadvent.py)\n- **FDA** - 语义分割任务中的傅里叶域适应 [[CVPR 2020]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2004.05498) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fsemantic_segmentation\u002Ffda.py)\n\n##### 关键点检测领域的领域自适应 [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fkeypoint_detection)\n- **RegDA** - 用于无监督关键点检测的回归型领域自适应 [[CVPR 2021]](http:\u002F\u002Fise.thss.tsinghua.edu.cn\u002F~mlong\u002Fdoc\u002Fregressive-domain-adaptation-cvpr21.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fkeypoint_detection)\n\n##### 人员重识别领域的领域自适应 [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fre_identification\u002F)\n- **IBN-Net** - 一举两得：通过 IBN-Net 提升学习与泛化能力 [[ECCV 2018]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ECCV_2018\u002Fpapers\u002FXingang_Pan_Two_at_Once_ECCV_2018_paper.pdf)\n- **MMT** - 相互均值教学：面向人员重识别无监督领域自适应的伪标签精炼 [[ICLR 2020]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2001.01526) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fre_identification\u002Fmmt.py)\n- **SPGAN** - 保持相似性的生成对抗网络 [[CVPR 2018]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1811.10551.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fre_identification\u002Fspgan.py)\n\n##### 部分领域自适应 [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fpartial_domain_adaptation)\n- **IWAN** - 基于重要性加权的对抗网络用于部分领域自适应 [[CVPR 2018]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1803.09210) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fpartial_domain_adaptation\u002Fiwan.py)\n- **AFN** - 范数越大越可迁移：一种用于无监督领域自适应的自适应特征范数方法 [[ICCV 2019]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1811.07456v2.pdf) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fpartial_domain_adaptation\u002Fafn.py)\n\n##### 开集领域自适应 [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fopenset_domain_adaptation)\n- **OSBP** - 通过反向传播实现开集领域自适应 [[ECCV 2018]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1804.10427) [[代码]](\u002Fexamples\u002Fdomain_adaptation\u002Fopenset_domain_adaptation\u002Fosbp.py)\n\n##### 分类任务的领域泛化 [[代码]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002F)\n- **IBN-Net** - 一举两得：通过 IBN-Net 提升学习与泛化能力 [[ECCV 2018]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ECCV_2018\u002Fpapers\u002FXingang_Pan_Two_at_Once_ECCV_2018_paper.pdf)\n- **MixStyle** - 使用 MixStyle 实现领域泛化 [[ICLR 2021]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2104.02008) [[代码]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002Fmixstyle.py)\n- **MLDG** - 学习如何泛化：面向领域泛化的元学习 [[AAAI 2018]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1710.03463.pdf) [[代码]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002Fmldg.py)\n- **IRM** - 不变风险最小化 [[ArXiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1907.02893) [[代码]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002Firm.py)\n- **VREx** - 通过风险外推实现分布外泛化 [[ICML 2021]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2003.00688) [[代码]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002Fvrex.py)\n- **GroupDRO** - 面向群体偏移的分布鲁棒神经网络：论正则化对最坏情况泛化的重要性 [[ArXiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1911.08731) [[代码]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002Fgroupdro.py)\n- **Deep CORAL** - 深度领域自适应中的相关性对齐 [[ECCV 2016]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1607.01719) [[代码]](\u002Fexamples\u002Fdomain_generalization\u002Fimage_classification\u002Fcoral.py)\n\n##### 人员重识别领域的领域泛化 [[代码]](\u002Fexamples\u002Fdomain_generalization\u002Fre_identification\u002F)\n- **IBN-Net** - 一举两得：通过 IBN-Net 提升学习与泛化能力 [[ECCV 2018]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_ECCV_2018\u002Fpapers\u002FXingang_Pan_Two_at_Once_ECCV_2018_paper.pdf)\n- **MixStyle** - 使用 MixStyle 实现领域泛化 [[ICLR 2021]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2104.02008) [[代码]](\u002Fexamples\u002Fdomain_generalization\u002Fre_identification\u002Fmixstyle.py)\n\n##### 图像分类任务的迁移适配（微调）[[代码]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002F)\n- **L2-SP** - 卷积网络迁移学习中的显式归纳偏置 [[ICML 2018]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1802.01483) [[代码]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Fdelta.py)\n- **BSS** - 灾难性遗忘遇上负迁移：批量谱收缩用于安全的迁移学习 [[NIPS 2019]](https:\u002F\u002Fproceedings.neurips.cc\u002Fpaper\u002F2019\u002Ffile\u002Fc6bff625bdb0393992c9d4db0c6bbe45-Paper.pdf) [[代码]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Fbss.py)\n- **DELTA** - 基于注意力机制的特征图深度学习迁移 [[ICLR 2019]](https:\u002F\u002Fopenreview.net\u002Fpdf?id=rkgbwsAcYm) [[代码]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Fdelta.py)\n- **Co-Tuning** - 迁移学习中的协同调优 [[NIPS 2020]](http:\u002F\u002Fise.thss.tsinghua.edu.cn\u002F~mlong\u002Fdoc\u002Fco-tuning-for-transfer-learning-nips20.pdf) [[代码]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Fco_tuning.py)\n- **StochNorm** - 随机归一化 [[NIPS 2020]](https:\u002F\u002Fpapers.nips.cc\u002Fpaper\u002F2020\u002Ffile\u002Fbc573864331a9e42e4511de6f678aa83-Paper.pdf) [[代码]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Fstochnorm.py)\n- **LWF** - 不忘旧知识的学习 [[ECCV 2016]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1606.09282) [[代码]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Flwf.py)\n- **Bi-Tuning** - 预训练表示的双向调优 [[ArXiv]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2011.06182?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+arxiv%2FQSXk+%28ExcitingAds%21+cs+updates+on+arXiv.org%29) [[代码]](\u002Fexamples\u002Ftask_adaptation\u002Fimage_classification\u002Fbi_tuning.py)\n\n##### 预训练模型选择 [[代码]](\u002Fexamples\u002Fmodel_selection)\n- **H-Score** - 基于信息论的任务迁移学习可迁移性评估方法 [[ICIP 2019]](http:\u002F\u002Fyangli-feasibility.com\u002Fhome\u002Fmedia\u002Ficip-19.pdf) [[代码]](\u002Fexamples\u002Fmodel_selection\u002Fhscore.py)\n- **NCE** - “可迁移性与监督分类任务难度”中的负条件熵 [[ICCV 2019]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1908.08142v1.pdf) [[代码]](\u002Fexamples\u002Fmodel_selection\u002Fnce.py)\n- **LEEP** - LEEP：一种评估学习表征可迁移性的新指标 [[ICML 2020]](http:\u002F\u002Fproceedings.mlr.press\u002Fv119\u002Fnguyen20b\u002Fnguyen20b.pdf) [[代码]](\u002Fexamples\u002Fmodel_selection\u002Fleep.py)\n- **LogME** - “LogME：预训练模型在迁移学习中实用评估”的最大证据对数 [[ICML 2021]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2102.11005.pdf) [[代码]](\u002Fexamples\u002Fmodel_selection\u002Flogme.py)\n\n##### 半监督学习用于分类 [[代码]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002F)\n- **伪标签** - 伪标签：一种简单高效的深度神经网络半监督学习方法 [[ICML 2013]](http:\u002F\u002Fciteseerx.ist.psu.edu\u002Fviewdoc\u002Fdownload?doi=10.1.1.664.3543&rep=rep1&type=pdf) [[代码]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fpseudo_label.py)\n- **Pi模型** - 用于半监督学习的时间集成 [[ICLR 2017]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1610.02242) [[代码]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fpi_model.py)\n- **均值教师** - 均值教师是更好的榜样：权重平均的一致性目标可提升半监督深度学习效果 [[NIPS 2017]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1703.01780) [[代码]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fmean_teacher.py)\n- **噪声学生** - 使用噪声学生的自训练可提升 ImageNet 分类性能 [[CVPR 2020]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_CVPR_2020\u002Fpapers\u002FXie_Self-Training_With_Noisy_Student_Improves_ImageNet_Classification_CVPR_2020_paper.pdf) [[代码]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fnoisy_student.py)\n- **UDA** - 用于一致性训练的无监督数据增强 [[NIPS 2020]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1904.12848v4.pdf) [[代码]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fuda.py)\n- **FixMatch** - 通过一致性和置信度简化半监督学习 [[NIPS 2020]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2001.07685) [[代码]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Ffixmatch.py)\n- **自调优** - 面向数据高效深度学习的自调优技术 [[ICML 2021]](http:\u002F\u002Fise.thss.tsinghua.edu.cn\u002F~mlong\u002Fdoc\u002FSelf-Tuning-for-Data-Efficient-Deep-Learning-icml21.pdf) [[代码]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fself_tuning.py)\n- **FlexMatch** - FlexMatch：利用课程式伪标签提升半监督学习效果 [[NIPS 2021]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2110.08263) [[代码]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fflexmatch.py)\n- **DebiasMatch** - 基于自然不均衡伪标签的去偏学习 [[CVPR 2022]](https:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent\u002FCVPR2022\u002Fpapers\u002FWang_Debiased_Learning_From_Naturally_Imbalanced_Pseudo-Labels_CVPR_2022_paper.pdf) [[代码]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fdebiasmatch.py)\n- **DST** - 面向半监督学习的去偏自训练 [[NIPS 2022 口头报告]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2202.07136) [[代码]](\u002Fexamples\u002Fsemi_supervised_learning\u002Fimage_classification\u002Fdst.py)\n\n\n\n## 安装\n\n##### 从源代码安装\n\n- 请先使用 git 克隆本库。然后运行以下命令以安装 `tllib` 及其所有依赖项。\n```shell\npython setup.py install\npip install -r requirements.txt\n```\n##### 通过 `pip` 安装\n\n- 目前通过 `pip` 安装仍处于实验阶段。\n\n```shell\npip install -i https:\u002F\u002Ftest.pypi.org\u002Fsimple\u002F tllib==0.4\n```\n\n\n## 文档\n\n您可以在网站上找到 API 文档：[文档](http:\u002F\u002Ftl.thuml.ai\u002F)。\n\n## 使用\n\n您可以在 `examples` 目录中找到示例。典型用法如下：\n```shell script\n# 在 Office-31 数据集上，使用 ResNet 50 训练 DANN 模型，任务为 Amazon → Webcam。\n# 假设您已将数据集放置在 `data\u002Foffice-31` 路径下，\n# 或者您愿意自动从互联网下载数据集到该路径。\npython dann.py data\u002Foffice31 -d Office31 -s A -t W -a resnet50 --epochs 20\n```\n\n## 贡献\n\n我们欢迎所有贡献。如果您计划提交 bug 修复，请直接操作，无需进一步讨论。若您打算贡献新功能、实用工具或扩展，请先创建议题并与我们讨论该功能。\n\n## 数据集免责声明\n\n本库是一个用于下载和准备公开数据集的工具库。我们不托管或分发这些数据集，也不对其质量或公平性作出保证，更不声称您拥有使用这些数据集的许可。您有责任根据数据集的许可协议确定自己是否具备使用权限。\n\n如果您是数据集的所有者，并希望更新其中的任何部分（如描述、引用等），或者不希望您的数据集被纳入本库，请通过 GitHub 议题与我们联系。感谢您对机器学习社区的贡献！\n\n\n## 联系方式\n\n如果您对我们的代码有任何问题或建议，包括未来功能的改进，欢迎随时联系：\n- Baixu Chen (cbx_99_hasta@outlook.com)\n- Junguang Jiang (JiangJunguang1123@outlook.com)\n- Mingsheng Long (longmingsheng@gmail.com)\n\n或在 Issues 中提出您的问题。\n\n如需中文答疑，您也可以先在此处提问，再发送邮件。[迁移学习算法库答疑专区](https:\u002F\u002Fzhuanlan.zhihu.com\u002Fp\u002F248104070)\n\n## 引用\n\n如果您在研究中使用了本工具箱或基准测试，请引用本项目。\n\n```latex\n@misc{jiang2022transferability,\n      title={深度学习中的迁移能力：综述}, \n      author={Junguang Jiang、Yang Shu、Jianmin Wang、Mingsheng Long},\n      year={2022},\n      eprint={2201.05867},\n      archivePrefix={arXiv},\n      primaryClass={cs.LG}\n}\n\n@misc{tllib,\n    author = {Junguang Jiang、Baixu Chen、Bo Fu、Mingsheng Long},\n    title = {迁移学习库},\n    year = {2020},\n    publisher = {GitHub},\n    journal = {GitHub 仓库},\n    howpublished = {\\url{https:\u002F\u002Fgithub.com\u002Fthuml\u002FTransfer-Learning-Library}},\n}\n```\n\n## 致谢\n\n我们衷心感谢清华大学软件学院以及大数据软件国家工程实验室，为我们的机器学习研究提供了如此优秀的平台。","# Transfer-Learning-Library 快速上手指南\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**: Linux, macOS 或 Windows\n*   **Python**: 3.6 及以上版本\n*   **核心框架**: PyTorch (纯 PyTorch 实现，无其他重型依赖)\n*   **可选依赖**: torchvision (用于数据加载和模型构建，设计风格与 TLlib 一致)\n\n建议先安装好基础的 PyTorch 环境。\n\n## 安装步骤\n\nTLlib 支持通过 `pip` 进行实验性安装。考虑到网络环境，推荐优先尝试国内镜像源加速安装。\n\n### 方式一：使用 pip 安装（推荐）\n\n**使用清华大学开源软件镜像源：**\n```shell\npip install -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple tllib==0.4\n```\n\n**或使用官方测试源（如镜像源暂无该版本）：**\n```shell\npip install -i https:\u002F\u002Ftest.pypi.org\u002Fsimple\u002F tllib==0.4\n```\n\n### 方式二：源码安装（获取最新功能）\n\n如果您需要最新的代码或示例，可以直接克隆仓库：\n\n```shell\ngit clone https:\u002F\u002Fgithub.com\u002Fthuml\u002FTransfer-Learning-Library.git\ncd Transfer-Learning-Library\npip install -e .\n```\n\n## 基本使用\n\nTLlib 的 API 设计遵循 Pythonic 风格，并与 `torchvision` 保持高度一致。库按方法类型划分为多个模块（如 `tllib.alignment`, `tllib.self_training` 等）。\n\n以下是一个基于 **DANN (Domain Adversarial Neural Network)** 进行图像分类域适应的最简使用流程示例：\n\n### 1. 导入必要模块\n\n```python\nimport torch\nimport torch.nn as nn\nfrom tllib.alignment.d_adapt import DannGenerator, DannDiscriminator\n# 假设您已准备好自己的 DataLoader (source_loader, target_loader)\n```\n\n### 2. 定义模型与算法组件\n\nTLlib 提供了标准的生成器（特征提取器 + 分类器）和判别器组件：\n\n```python\n# 初始化生成器 (通常包含 backbone 和 classifier)\ngenerator = DannGenerator(backbone=your_resnet_model, num_classes=num_classes)\n\n# 初始化域判别器\ndiscriminator = DannDiscriminator(in_features=feature_dim)\n\n# 定义优化器\noptimizer_g = torch.optim.SGD(generator.parameters(), lr=0.01)\noptimizer_d = torch.optim.SGD(discriminator.parameters(), lr=0.01)\n\n# 定义损失函数\ndomain_criterion = nn.BCELoss()\ntask_criterion = nn.CrossEntropyLoss()\n```\n\n### 3. 训练循环示例\n\n在训练步中，交替优化生成器和判别器，这是 DANN 的核心逻辑：\n\n```python\nfor i, ((source_images, source_labels), (target_images, _)) in enumerate(zip(source_loader, target_loader)):\n    \n    # --- 训练域判别器 ---\n    optimizer_d.zero_grad()\n    \n    source_features = generator.extract_features(source_images)\n    target_features = generator.extract_features(target_images)\n    \n    source_domain_output = discriminator(source_features.detach())\n    target_domain_output = discriminator(target_features.detach())\n    \n    # 构造标签：源域为 1，目标域为 0\n    domain_labels_source = torch.ones_like(source_domain_output)\n    domain_labels_target = torch.zeros_like(target_domain_output)\n    \n    loss_d = domain_criterion(source_domain_output, domain_labels_source) + \\\n             domain_criterion(target_domain_output, domain_labels_target)\n    \n    loss_d.backward()\n    optimizer_d.step()\n\n    # --- 训练生成器 (特征提取器 + 分类器) ---\n    optimizer_g.zero_grad()\n    \n    # 再次前向传播\n    source_features = generator.extract_features(source_images)\n    target_features = generator.extract_features(target_images)\n    \n    # 分类任务损失\n    source_predictions = generator.classify(source_features)\n    loss_task = task_criterion(source_predictions, source_labels)\n    \n    # 域对抗损失 (梯度反转层通常在 generator 内部或作为独立模块处理，此处简化演示逻辑)\n    # 实际使用中，TLlib 的 DannGenerator 通常内置了梯度反转逻辑或需配合特定 wrapper\n    source_domain_output_adv = discriminator(source_features)\n    target_domain_output_adv = discriminator(target_features)\n    \n    # 生成器希望混淆判别器：源域标为 0，目标域标为 1 (与判别器目标相反)\n    loss_adv = domain_criterion(source_domain_output_adv, domain_labels_target) + \\\n               domain_criterion(target_domain_output_adv, domain_labels_source)\n    \n    loss_g = loss_task + loss_adv\n    loss_g.backward()\n    optimizer_g.step()\n```\n\n> **提示**：TLlib 在 `examples` 目录下提供了完整的、可直接运行的脚本（如 `examples\u002Fdomain_adaptation\u002Fimage_classification\u002Fdann.py`），涵盖了数据加载、模型定义及完整的训练评估流程，建议开发者直接参考这些示例进行二次开发。","某自动驾驶初创公司的算法团队正试图将模型从白天晴朗的仿真数据（源域）迁移到夜间雨天的真实路测数据（目标域），以解决恶劣天气下目标检测准确率骤降的问题。\n\n### 没有 Transfer-Learning-Library 时\n- **复现成本极高**：团队需手动从零复现 DANN、CDAN 等经典域适应算法，耗费数周时间调试对抗性训练的不稳定性，且代码风格不统一，难以维护。\n- **实验对比困难**：缺乏统一的评估框架，每次尝试新策略（如切换为 JAN 或 ADDA）都需要重写大量数据加载和模型对齐代码，导致无法快速横向对比不同方法的效果。\n- **任务适配局限**：现有的自研脚本仅支持图像分类，面对物体检测任务时，特征对齐逻辑完全失效，不得不重新推导公式并修改底层反向传播逻辑。\n- **调参盲目低效**：缺少内置的模型选择与正则化工具，工程师只能凭经验盲目调整超参数，导致模型在目标域上过拟合或欠拟合，迭代周期漫长。\n\n### 使用 Transfer-Learning-Library 后\n- **即插即用算法**：直接调用 `tllib.alignment.d_adapt` 模块中预置的域适应检测算法，几行代码即可集成 DANN 或 CDAN，将算法验证周期从数周缩短至几天。\n- **标准化实验流程**：利用其类 torchvision 的统一 API 架构，轻松切换 DAN、JAN 等不同方法进行消融实验，快速锁定最适合雨天场景的迁移策略。\n- **多任务原生支持**：直接使用库中针对物体检测优化的专用接口，无需修改底层逻辑即可实现仿真到实物的特征对齐，显著提升了车辆与行人的检出率。\n- **智能模型优选**：借助 `tllib.ranking` 模块自动评估预训练模型在目标域的迁移潜力，科学指导超参数调整，避免了无效试错，大幅提升了最终模型的泛化性能。\n\nTransfer-Learning-Library 通过提供标准化、高性能的迁移学习组件，让团队从繁琐的算法复现中解放出来，专注于解决真实场景中的分布偏移难题。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fthuml_Transfer-Learning-Library_e71401d1.png","thuml","THUML @ Tsinghua University","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fthuml_2b45f3ea.png","Machine Learning Group, School of Software, Tsinghua University",null,"mingsheng@tsinghua.edu.cn","http:\u002F\u002Fise.thss.tsinghua.edu.cn\u002F~mlong","https:\u002F\u002Fgithub.com\u002Fthuml",[84],{"name":85,"color":86,"percentage":87},"Python","#3572A5",100,3891,591,"2026-04-01T13:03:55","MIT","未说明","未说明（基于 PyTorch，通常建议配备 NVIDIA GPU 以加速深度学习训练）",{"notes":95,"python":92,"dependencies":96},"该库基于纯 PyTorch 构建，设计风格与 torchvision 一致。支持通过 pip 实验性安装（tllib==0.4）。文档提供离线版下载。部分数据集链接可能失效，需参考 DATASETS.md。具体任务（如目标检测、分割等）的运行环境需求取决于所使用的具体模型架构，README 中未列出统一的硬件配置要求。",[97,98],"torch","torchvision",[14,26,13],[101,102,103,104,105,106,107,108,109,110,111],"domain-adaptation","transfer-learning","finetune","unsupervised-domain-adaptation","image-translation","adversarial-learning","deep-learning","self-training","semi-supervised-learning","dann","out-of-distribution-generalization","2026-03-27T02:49:30.150509","2026-04-06T05:15:03.124699",[115,120,124,129,134,139,144,149],{"id":116,"question_zh":117,"answer_zh":118,"source_url":119},13529,"为什么我运行的实验结果与作者提供的结果差异很大？","如果您使用的是自己实现的代码，请检查域鉴别器（domain discriminator）部分的参数是否被正确更新，或者学习率是否设置得过高。如果是使用库自带代码，请确认数据集的划分方式（如 train\u002Ftest split）是否与论文或示例一致。此外，确认是否记录了最终模式（final_mode）那一轮的结果作为最终精度。","https:\u002F\u002Fgithub.com\u002Fthuml\u002FTransfer-Learning-Library\u002Fissues\u002F183",{"id":121,"question_zh":122,"answer_zh":123,"source_url":119},13530,"在使用 DANN 或 ADVENT 进行对齐时，损失值为什么不变化？","损失不变化通常是因为调用方式或梯度传递有问题。对于 DANN，确保在计算损失前使用了梯度反转层（GRL），即 `grl(input)`，然后再输入到鉴别器中。对于 ADVENT，检查 Discriminator 的初始化参数（如 num_classes）是否与特征维度匹配，并确认损失计算逻辑中源域和目标域的标签（\"source\", \"target\"）传递正确。如果损失始终不变，可能是鉴别器未参与反向传播或学习率过低。",{"id":125,"question_zh":126,"answer_zh":127,"source_url":128},13531,"程序启动后卡住不动，GPU 显存未占用，疑似数据未加载，如何解决？","建议不要通过 `pip install dalib` 安装，而是直接克隆仓库源码使用（`git clone`）。同时仔细检查运行环境，包括 CUDA、cuDNN 版本以及 NVIDIA 驱动是否正常。如果问题依旧，尝试创建一个全新的虚拟环境，重新克隆仓库并安装依赖，这通常能解决因环境配置冲突导致的数据读取卡顿问题。","https:\u002F\u002Fgithub.com\u002Fthuml\u002FTransfer-Learning-Library\u002Fissues\u002F11",{"id":130,"question_zh":131,"answer_zh":132,"source_url":133},13532,"DANN 训练中域鉴别器的分类准确率达到了 100%，这正常吗？","理论上域鉴别器准确率应趋近于 50%（无法区分源域和目标域）。如果达到 100% 但目标域性能仍提升，可能是特征分布差异过大或训练不稳定。请检查代码实现中是否包含了梯度反转层（GRL）。在库的实现中，GRL 通常封装在对齐 loss 计算模块的 `forward` 函数第一步（`grl(input)`），而不是单独写在鉴别器网络结构中。如果没有 GRL，鉴别器会过度优化，导致迁移失败。","https:\u002F\u002Fgithub.com\u002Fthuml\u002FTransfer-Learning-Library\u002Fissues\u002F267",{"id":135,"question_zh":136,"answer_zh":137,"source_url":138},13533,"如何加载自定义数据集进行域自适应训练？","可以加载自定义数据集。您不需要严格遵循库内置的数据集格式，只需改写数据集加载过程（Dataset Loader）以适配您的数据格式即可。参考相关 Issue 中的讨论，核心是确保 DataLoader 能正确返回源域和目标域的图像及标签（如果有）。对于 DANN 等基础方法，即使类别空间不完全一致也可运行（仅做特征拉近），但若需处理开放集（Open-set）或部分集（Partial DA）场景，建议使用库中专门的算法实现。","https:\u002F\u002Fgithub.com\u002Fthuml\u002FTransfer-Learning-Library\u002Fissues\u002F181",{"id":140,"question_zh":141,"answer_zh":142,"source_url":143},13534,"CycleGAN 和 Decouple Adaptation 这两种方法是独立的吗？CycleGAN 在其中的作用是什么？","它们是相互独立的。CycleGAN 是一种用于数据增强的方法（例如将源域图像风格转换为目标域风格），而 Decouple Adaptation 是一种具体的域自适应目标检测算法。您可以在训练集中先使用 CycleGAN 生成类似目标域的新数据，再结合 Decouple Adaptation 进行训练。CycleGAN 中的对抗过程类似于 HTCN，主要用于解决域间风格差异，特别是在 Cityscapes 到 Foggy Cityscapes 这类定义明确的任务中有效。","https:\u002F\u002Fgithub.com\u002Fthuml\u002FTransfer-Learning-Library\u002Fissues\u002F119",{"id":145,"question_zh":146,"answer_zh":147,"source_url":148},13535,"在多 GPU 环境下运行域自适应（DA）训练时性能下降或报错，有什么解决方案？","由于大部分 DA 训练方式（涉及域鉴别器和梯度反转）在多卡同步时可能出现性能下降或不稳定，推荐的解决方案是混合训练策略：将涉及域自适应的部分（DA 训练）使用单卡运行，而将不涉及 DA 的部分（如基于伪标签的检测器训练）使用多卡并行训练。此外，注意检查是否使用了 SyncBN（同步批归一化）以避免批次统计量在不同卡之间不一致的问题。","https:\u002F\u002Fgithub.com\u002Fthuml\u002FTransfer-Learning-Library\u002Fissues\u002F171",{"id":150,"question_zh":151,"answer_zh":152,"source_url":143},13536,"Cityscapes\u002FFoggy Cityscapes 数据集转换后索引数量与论文不符（如 test.txt 只有 493 个而非 500 个），这是错误吗？","这通常不是错误。Cityscapes 到 Foggy Cityscapes 是一个特殊的任务，源域和目标域图像存在一对一的映射关系。在实际的数据集预处理脚本（如 `prepare_cityscapes_to_voc.py`）中，可能会因为部分图像不符合 VOC 格式要求或缺失标注而被过滤，导致索引数量略少于论文理论值。只要主要测试集覆盖完整，少量的索引差异通常不会影响最终的公平比较和算法有效性验证。",[154,159,164],{"id":155,"version":156,"summary_zh":157,"released_at":158},72366,"v0.4","### 亮点\n- 我们根据我们的调研论文《深度学习中的迁移性》（[arXiv:2201.05867](https:\u002F\u002Farxiv.org\u002Fabs\u002F2201.05867)）调整了我们的API。\n- 支持目标检测领域的领域自适应\n- 支持预训练模型选择\n- 支持分类任务的半监督学习","2022-08-03T09:06:34",{"id":160,"version":161,"summary_zh":162,"released_at":163},72367,"v0.3","### 亮点\n- 支持分类任务和行人重识别任务的领域泛化\n- 支持行人重识别任务的领域自适应","2022-08-03T08:18:17",{"id":165,"version":166,"summary_zh":167,"released_at":168},72368,"v0.2","### 亮点\n\n- 支持分割任务的域适应\n- 支持关键点检测任务的域适应\n- 支持分类任务的微调\n","2021-10-08T07:46:35"]