[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-ImprintLab--MedSegDiff":3,"tool-ImprintLab--MedSegDiff":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",140436,2,"2026-04-05T23:32:43",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":10,"last_commit_at":50,"category_tags":51,"status":17},4292,"Deep-Live-Cam","hacksider\u002FDeep-Live-Cam","Deep-Live-Cam 是一款专注于实时换脸与视频生成的开源工具，用户仅需一张静态照片，即可通过“一键操作”实现摄像头画面的即时变脸或制作深度伪造视频。它有效解决了传统换脸技术流程繁琐、对硬件配置要求极高以及难以实时预览的痛点，让高质量的数字内容创作变得触手可及。\n\n这款工具不仅适合开发者和技术研究人员探索算法边界，更因其极简的操作逻辑（仅需三步：选脸、选摄像头、启动），广泛适用于普通用户、内容创作者、设计师及直播主播。无论是为了动画角色定制、服装展示模特替换，还是制作趣味短视频和直播互动，Deep-Live-Cam 都能提供流畅的支持。\n\n其核心技术亮点在于强大的实时处理能力，支持口型遮罩（Mouth Mask）以保留使用者原始的嘴部动作，确保表情自然精准；同时具备“人脸映射”功能，可同时对画面中的多个主体应用不同面孔。此外，项目内置了严格的内容安全过滤机制，自动拦截涉及裸露、暴力等不当素材，并倡导用户在获得授权及明确标注的前提下合规使用，体现了技术发展与伦理责任的平衡。",88924,"2026-04-06T03:28:53",[14,15,13,52],"视频",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},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",[14,35],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":77,"owner_email":77,"owner_twitter":77,"owner_website":77,"owner_url":78,"languages":79,"stars":84,"forks":85,"last_commit_at":86,"license":87,"difficulty_score":10,"env_os":88,"env_gpu":89,"env_ram":88,"env_deps":90,"category_tags":98,"github_topics":99,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":106,"updated_at":107,"faqs":108,"releases":139},4340,"ImprintLab\u002FMedSegDiff","MedSegDiff","Using Diffusion Models to Segment\u002FReconstruct Organs from Medical Images [AAAI Most influential Paper]","MedSegDiff 是一款基于扩散概率模型（DPM）的开源框架，专为医学图像中器官与组织的分割及重建任务而设计。在传统医学影像分析中，精准勾勒病灶或器官边界往往面临噪声干扰大、形态复杂等挑战，而 MedSegDiff 创新性地引入扩散模型技术，通过模拟去噪过程逐步生成高精度的分割掩码，有效提升了复杂场景下的识别准确率与鲁棒性。\n\n该项目包含两个核心版本：初代版本奠定了扩散模型在医学分割中的应用基础，而荣获 AAAI 2024“最具影响力论文”殊荣的 MedSegDiff-V2 则进一步融合 Transformer 架构，在保持计算资源友好的同时，显著增强了模型的稳定性与跨域适应能力。此外，工具还集成了 DPM-Solver 加速算法，将采样步骤从千级大幅压缩至二十步左右，极大缩短了推理时间。\n\nMedSegDiff 非常适合医学 AI 领域的研究人员、算法开发者以及生物医学工程师使用。无论是需要复现前沿学术成果、构建辅助诊断系统，还是处理如皮肤黑色素瘤（ISIC 数据集）或脑部肿瘤（BraTS 数据集）等具体临床数据，它都提供了成熟的代码实现与数据处理流程。对于希望探索生成式 AI ","MedSegDiff 是一款基于扩散概率模型（DPM）的开源框架，专为医学图像中器官与组织的分割及重建任务而设计。在传统医学影像分析中，精准勾勒病灶或器官边界往往面临噪声干扰大、形态复杂等挑战，而 MedSegDiff 创新性地引入扩散模型技术，通过模拟去噪过程逐步生成高精度的分割掩码，有效提升了复杂场景下的识别准确率与鲁棒性。\n\n该项目包含两个核心版本：初代版本奠定了扩散模型在医学分割中的应用基础，而荣获 AAAI 2024“最具影响力论文”殊荣的 MedSegDiff-V2 则进一步融合 Transformer 架构，在保持计算资源友好的同时，显著增强了模型的稳定性与跨域适应能力。此外，工具还集成了 DPM-Solver 加速算法，将采样步骤从千级大幅压缩至二十步左右，极大缩短了推理时间。\n\nMedSegDiff 非常适合医学 AI 领域的研究人员、算法开发者以及生物医学工程师使用。无论是需要复现前沿学术成果、构建辅助诊断系统，还是处理如皮肤黑色素瘤（ISIC 数据集）或脑部肿瘤（BraTS 数据集）等具体临床数据，它都提供了成熟的代码实现与数据处理流程。对于希望探索生成式 AI 在医疗影像落地应用的团队而言，这是一个兼具理论深度与工程实用价值的优秀起点。","\n\n\n  # MedSegDiff: Medical Image Segmentation with Diffusion Model\n\u003Cimg align=\"left\" width=\"150\" height=\"150\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FImprintLab_MedSegDiff_readme_0c154575c866.png\"> \nMedSegDiff is a Diffusion Probabilistic Model (DPM) based framework for the Segmentation and Reconstruction of organs\u002Ftissues from the medical images.\n\nThe algorithm is elaborated on our paper\n\n[MedSegDiff: Medical Image Segmentation with Diffusion Probabilistic Model](https:\u002F\u002Farxiv.org\u002Fabs\u002F2211.00611) \n\n[MedSegDiff-V2: Diffusion based Medical Image Segmentation with Transformer](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2301.11798.pdf).\n\n\n\n## A Quick Overview \n\n|\u003Cimg align=\"left\" width=\"480\" height=\"170\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FImprintLab_MedSegDiff_readme_cc2cd64c56f7.png\">|\u003Cimg align=\"right\" width=\"450\" height=\"270\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FImprintLab_MedSegDiff_readme_3c99e0fcbf14.png\">|\n|:--:|:--:| \n| **MedSegDiff-V1** | **MedSegDiff-V2** |\n\n## News\n- [TOP] Join in our [Discord](https:\u002F\u002Fdiscord.gg\u002FCQQWtaQgRS) to ask questions and discuss with others.\n- 22-11-30. This project is still quickly updating. Check TODO list to see what will be released next.\n- 22-12-03. BraTs2020 bugs fixed. Example case added.\n- 22-12-15. Fix multi-gpu distributed training.\n- 22-12-16. DPM-Solver ✖️ MedSegDiff DONE 🥳 Now [DPM-Solver](https:\u002F\u002Fgithub.com\u002FLuChengTHU\u002Fdpm-solver) is avaliable in MedsegDiff. Enjoy its lightning-fast sampling (1000 steps ❌ 20 steps ⭕️) by setting ``--dpm_solver True``. \n- 22-12-23. Fixed some bugs of DPM-Solver.\n- 23-01-31. MedSegDiff-V2 will be avaliable soon 🥳 . Check our paper [MedSegDiff-V2: Diffusion based Medical Image Segmentation with Transformer](https:\u002F\u002Farxiv.org\u002Fabs\u002F2301.11798) first.\n- 23-02-07. Optimize workflow in BRATS sampling. Add dataloader for processing raw 3D BRATS data.\n- 23-02-11. Fix bugs 3D BRATS data training bugs, [issue 31](https:\u002F\u002Fgithub.com\u002FWuJunde\u002FMedSegDiff\u002Fissues\u002F31).\n- 23-03-04. Paper [MedSegDiff: Medical Image Segmentation with Diffusion Probabilistic Model](https:\u002F\u002Farxiv.org\u002Fabs\u002F2211.00611) has been officially accepted by MIDL 2023 🥳\n- 23-04-11. A new version based on the v2 framework has been released 🥳. It's more accurate, stable, and domain-adaptable than the previous version, while still not hogging too much of your resources. We've also fixed up a bunch of small things, like the requirement.txt and isic csv files. Huge thanks to all of you who reported issues, you really helped us a lot 🤗. btw, it will run the new version by default. Add \"--version 1\" if you want run the previous version. \n- 23-04-12. Added a simple evaluation file for isic dataset (script\u002Fsegmentation_env). Usage: ``python scripts\u002Fsegmentation_env.py --inp_pth *folder you save prediction images* --out_pth *folder you save ground truth images*``\n- 23-12-05. Paper [MedSegDiff-V2: Diffusion based Medical Image Segmentation with Transformer](https:\u002F\u002Farxiv.org\u002Fabs\u002F2301.11798) has been officially accepted by AAAI 2024 🥳\n- 24-10-29. MedSegDiff-V2 has been selected as AAAI-24 Most Influential Paper 🥳\n\n## Requirement\n\n``pip install -r requirement.txt``\n\n## Example Cases\n### Melanoma Segmentation from Skin Images\n1. Download ISIC dataset from https:\u002F\u002Fchallenge.isic-archive.com\u002Fdata\u002F. Your dataset folder under \"data\" should be like:\n\n~~~\ndata\n|   ----ISIC\n|       ----Test\n|       |   |   ISBI2016_ISIC_Part1_Test_GroundTruth.csv\n|       |   |   \n|       |   ----ISBI2016_ISIC_Part1_Test_Data\n|       |   |       ISIC_0000003.jpg\n|       |   |       .....\n|       |   |\n|       |   ----ISBI2016_ISIC_Part1_Test_GroundTruth\n|       |           ISIC_0000003_Segmentation.png\n|       |   |       .....\n|       |           \n|       ----Train\n|           |   ISBI2016_ISIC_Part1_Training_GroundTruth.csv\n|           |   \n|           ----ISBI2016_ISIC_Part1_Training_Data\n|           |       ISIC_0000000.jpg\n|           |       .....\n|           |       \n|           ----ISBI2016_ISIC_Part1_Training_GroundTruth\n|           |       ISIC_0000000_Segmentation.png\n|           |       .....\n~~~\n\n    \n2. For training, run: ``python scripts\u002Fsegmentation_train.py --data_name ISIC --data_dir *input data direction* --out_dir *output data direction* --image_size 256 --num_channels 128 --class_cond False --num_res_blocks 2 --num_heads 1 --learn_sigma True --use_scale_shift_norm False --attention_resolutions 16 --diffusion_steps 1000 --noise_schedule linear --rescale_learned_sigmas False --rescale_timesteps False --lr 1e-4 --batch_size 8``\n\n3. For sampling, run: ``python scripts\u002Fsegmentation_sample.py --data_name ISIC --data_dir *input data direction* --out_dir *output data direction* --model_path *saved model* --image_size 256 --num_channels 128 --class_cond False --num_res_blocks 2 --num_heads 1 --learn_sigma True --use_scale_shift_norm False --attention_resolutions 16 --diffusion_steps 1000 --noise_schedule linear --rescale_learned_sigmas False --rescale_timesteps False --num_ensemble 5``\n\n4. For evaluation, run ``python scripts\u002Fsegmentation_env.py --inp_pth *folder you save prediction images* --out_pth *folder you save ground truth images*``\n\n\nIn default, the samples will be saved at `` .\u002Fresults\u002F`` \n### Brain Tumor Segmentation from MRI\n1. Download BRATS2020 dataset from https:\u002F\u002Fwww.med.upenn.edu\u002Fcbica\u002Fbrats2020\u002Fdata.html. Your dataset folder should be like:\n~~~\ndata\n└───training\n│   └───slice0001\n│       │   brats_train_001_t1_123_w.nii.gz\n│       │   brats_train_001_t2_123_w.nii.gz\n│       │   brats_train_001_flair_123_w.nii.gz\n│       │   brats_train_001_t1ce_123_w.nii.gz\n│       │   brats_train_001_seg_123_w.nii.gz\n│   └───slice0002\n│       │  ...\n└───testing\n│   └───slice1000\n│       │  ...\n│   └───slice1001\n│       │  ...\n~~~\n    \n2. For training, run: ``python scripts\u002Fsegmentation_train.py --data_dir (where you put data folder)\u002Fdata\u002Ftraining --out_dir output data direction --image_size 256 --num_channels 128 --class_cond False --num_res_blocks 2 --num_heads 1 --learn_sigma True --use_scale_shift_norm False --attention_resolutions 16 --diffusion_steps 1000 --noise_schedule linear --rescale_learned_sigmas False --rescale_timesteps False --lr 1e-4 --batch_size 8``\n\n3. For sampling, run: ``python scripts\u002Fsegmentation_sample.py --data_dir (where you put data folder)\u002Fdata\u002Ftesting --out_dir output data direction --model_path saved model --image_size 256 --num_channels 128 --class_cond False --num_res_blocks 2 --num_heads 1 --learn_sigma True --use_scale_shift_norm False --attention_resolutions 16 --diffusion_steps 1000 --noise_schedule linear --rescale_learned_sigmas False --rescale_timesteps False --num_ensemble 5``\n\n\n### Other Examples\n...\n### Run on  your own dataset\nIt is simple to run MedSegDiff on the other datasets. Just write another data loader file following `` .\u002Fguided_diffusion\u002Fisicloader.py`` or `` .\u002Fguided_diffusion\u002Fbratsloader.py``.  Welcome to open issues if you meet any problem. It would be appreciated if you could contribute your dataset extensions. Unlike natural images, medical images vary a lot depending on different tasks. Expanding the generalization of a method requires everyone's efforts.\n## Suggestions for Hyperparameters and Training\nTo train a fine model, i.e., MedSegDiff-B in the paper, set the model hyperparameters as:\n~~~\n--image_size 256 --num_channels 128 --class_cond False --num_res_blocks 2 --num_heads 1 --learn_sigma True --use_scale_shift_norm False --attention_resolutions 16 \n~~~\ndiffusion hyperparameters as:\n~~~\n--diffusion_steps 1000 --noise_schedule linear --rescale_learned_sigmas False --rescale_timesteps False\n~~~\nTo speed up the sampling:\n~~~\n--diffusion_steps 50 --dpm_solver True \n~~~\nrun on multiple GPUs:\n~~~\n--multi-gpu 0,1,2 (for example)\n~~~\ntraining hyperparameters as:\n~~~\n--lr 5e-5 --batch_size 8\n~~~\nand set ``--num_ensemble 5`` in sampling.\n\nRun about 100,000 steps in training will be converged on most of the datasets. Note that although loss will not decrease in most of the later steps, the quality of the results are still improving. Such a process is also observed on the other DPM applications, like image generation. Hope someone smart can tell me why🥲.\n\nI will soon publish its performance under smaller batch size (suitable to run on 24GB GPU) for the need of comparison🤗.\n\nA setting to unleash all its potential is (MedSegDiff++):\n~~~\n--image_size 256 --num_channels 512 --class_cond False --num_res_blocks 12 --num_heads 8 --learn_sigma True --use_scale_shift_norm True --attention_resolutions 24 \n~~~\nThen train it with batch size ``--batch_size 64`` and sample it with ensemble number ``--num_ensemble 25``.\n\n## TODO LIST\n\n- [x] Fix bugs in BRATS. Add BRATS example.\n- [x] Release REFUGE and DDIT dataloaders and examples\n- [x] Speed up sampling by DPM-solver\n- [ ] Inference of depth\n- [x] Fix bugs in Multi-GPU parallel\n- [x] Sample and Vis in training\n- [x] Release pre processing and post processing\n- [x] Release evaluation\n- [x] Deploy on HuggingFace\n- [x] configuration\n\n## Thanks\nCode copied a lot from [openai\u002Fimproved-diffusion](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fimproved-diffusion), [WuJunde\u002F MrPrism](https:\u002F\u002Fgithub.com\u002FWuJunde\u002FMrPrism), [WuJunde\u002F DiagnosisFirst](https:\u002F\u002Fgithub.com\u002FWuJunde\u002FDiagnosisFirst), [LuChengTHU\u002Fdpm-solver](https:\u002F\u002Fgithub.com\u002FLuChengTHU\u002Fdpm-solver), [JuliaWolleb\u002FDiffusion-based-Segmentation](https:\u002F\u002Fgithub.com\u002FJuliaWolleb\u002FDiffusion-based-Segmentation), [hojonathanho\u002Fdiffusion](https:\u002F\u002Fgithub.com\u002Fhojonathanho\u002Fdiffusion), [guided-diffusion](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fguided-diffusion), [bigmb\u002FUnet-Segmentation-Pytorch-Nest-of-Unets](https:\u002F\u002Fgithub.com\u002Fbigmb\u002FUnet-Segmentation-Pytorch-Nest-of-Unets), [nnUnet](https:\u002F\u002Fgithub.com\u002FMIC-DKFZ\u002FnnUNet), [lucidrains\u002Fvit-pytorch](https:\u002F\u002Fgithub.com\u002Flucidrains\u002Fvit-pytorch)\n## Cite\nPlease cite\n~~~\n@inproceedings{wu2023medsegdiff,\n  title={MedSegDiff: Medical Image Segmentation with Diffusion Probabilistic Model},\n  author={Wu, Junde and FU, RAO and Fang, Huihui and Zhang, Yu and Yang, Yehui and Xiong, Haoyi and Liu, Huiying and Xu, Yanwu},\n  booktitle={Medical Imaging with Deep Learning},\n  year={2023}\n}\n~~~\n\n~~~\n@article{wu2023medsegdiff,\n  title={MedSegDiff-V2: Diffusion based Medical Image Segmentation with Transformer},\n  author={Wu, Junde and Ji, Wei and Fu, Huazhu and Xu, Min and Jin, Yueming and Xu, Yanwu}\n  journal={arXiv preprint arXiv:2301.11798},\n  year={2023}\n}\n~~~\n\n\n\n\n","# MedSegDiff：基于扩散模型的医学图像分割\n\u003Cimg align=\"left\" width=\"150\" height=\"150\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FImprintLab_MedSegDiff_readme_0c154575c866.png\"> \nMedSegDiff 是一个基于扩散概率模型（DPM）的框架，用于从医学图像中对器官\u002F组织进行分割和重建。\n\n该算法在我们的论文中有详细阐述：\n\n[MedSegDiff：基于扩散概率模型的医学图像分割](https:\u002F\u002Farxiv.org\u002Fabs\u002F2211.00611) \n\n[MedSegDiff-V2：基于Transformer的扩散式医学图像分割](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2301.11798.pdf).\n\n\n\n## 快速概览 \n\n|\u003Cimg align=\"left\" width=\"480\" height=\"170\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FImprintLab_MedSegDiff_readme_cc2cd64c56f7.png\">|\u003Cimg align=\"right\" width=\"450\" height=\"270\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FImprintLab_MedSegDiff_readme_3c99e0fcbf14.png\">|\n|:--:|:--:| \n| **MedSegDiff-V1** | **MedSegDiff-V2** |\n\n## 最新消息\n- [置顶] 加入我们的 [Discord](https:\u002F\u002Fdiscord.gg\u002FCQQWtaQgRS)，提问并与大家交流。\n- 22-11-30。本项目仍在快速更新中。请查看 TODO 列表，了解接下来将发布的内容。\n- 22-12-03。修复了 BraTs2020 的一些错误，并添加了示例案例。\n- 22-12-15。修复了多 GPU 分布式训练的问题。\n- 22-12-16。DPM-Solver ✖️ MedSegDiff 完成 🥳 现在 [DPM-Solver](https:\u002F\u002Fgithub.com\u002FLuChengTHU\u002Fdpm-solver) 已集成到 MedsegDiff 中。通过设置 ``--dpm_solver True``，即可享受其闪电般的采样速度（1000 步 ❌ 20 步 ⭕️）。\n- 22-12-23。修复了 DPM-Solver 中的一些 bug。\n- 23-01-31。MedSegDiff-V2 即将发布 🥳 。请先阅读我们的论文 [MedSegDiff-V2：基于Transformer的扩散式医学图像分割](https:\u002F\u002Farxiv.org\u002Fabs\u002F2301.11798)。\n- 23-02-07。优化了 BRATS 数据采样的工作流程，并新增了用于处理原始 3D BRATS 数据的数据加载器。\n- 23-02-11。修复了 3D BRATS 数据训练中的 bug，参见 [issue 31](https:\u002F\u002Fgithub.com\u002FWuJunde\u002FMedSegDiff\u002Fissues\u002F31)。\n- 23-03-04。论文 [MedSegDiff：基于扩散概率模型的医学图像分割](https:\u002F\u002Farxiv.org\u002Fabs\u002F2211.00611) 已被 MIDL 2023 正式接受 🥳\n- 23-04-11。基于 V2 框架的新版本已发布 🥳。相比之前版本，它更加准确、稳定且具有更好的领域适应性，同时不会占用过多资源。我们还修复了一些小问题，比如 requirement.txt 和 isic csv 文件。非常感谢所有报告问题的用户，你们的帮助对我们至关重要 🤗。顺便说一下，现在默认运行的是新版本。如果想使用旧版本，请添加 `--version 1`。\n- 23-04-12。为 isic 数据集添加了一个简单的评估文件（script\u002Fsegmentation_env）。使用方法：``python scripts\u002Fsegmentation_env.py --inp_pth *保存预测图像的文件夹* --out_pth *保存真实标签图像的文件夹*``\n- 23-12-05。论文 [MedSegDiff-V2：基于Transformer的扩散式医学图像分割](https:\u002F\u002Farxiv.org\u002Fabs\u002F2301.11798) 已被 AAAI 2024 正式接受 🥳\n- 24-10-29。MedSegDiff-V2 被评选为 AAAI-24 最具影响力论文 🥳\n\n## 系统要求\n\n``pip install -r requirement.txt``\n\n## 示例案例\n### 皮肤图像中的黑色素瘤分割\n1. 从 https:\u002F\u002Fchallenge.isic-archive.com\u002Fdata\u002F 下载 ISIC 数据集。您的数据集文件夹应位于 \"data\" 目录下，结构如下：\n\n~~~\ndata\n|   ----ISIC\n|       ----Test\n|       |   |   ISBI2016_ISIC_Part1_Test_GroundTruth.csv\n|       |   |   \n|       |   ----ISBI2016_ISIC_Part1_Test_Data\n|       |   |       ISIC_0000003.jpg\n|       |   |       .....\n|       |   |\n|       |   ----ISBI2016_ISIC_Part1_Test_GroundTruth\n|       |           ISIC_0000003_Segmentation.png\n|       |   |       .....\n|       |           \n|       ----Train\n|           |   ISBI2016_ISIC_Part1_Training_GroundTruth.csv\n|           |   \n|           ----ISBI2016_ISIC_Part1_Training_Data\n|           |       ISIC_0000000.jpg\n|           |       .....\n|           |       \n|           ----ISBI2016_ISIC_Part1_Training_GroundTruth\n|           |       ISIC_0000000_Segmentation.png\n|           |       .....\n~~~\n\n    \n2. 训练时，运行：``python scripts\u002Fsegmentation_train.py --data_name ISIC --data_dir *输入数据路径* --out_dir *输出数据路径* --image_size 256 --num_channels 128 --class_cond False --num_res_blocks 2 --num_heads 1 --learn_sigma True --use_scale_shift_norm False --attention_resolutions 16 --diffusion_steps 1000 --noise_schedule linear --rescale_learned_sigmas False --rescale_timesteps False --lr 1e-4 --batch_size 8``\n\n3. 采样时，运行：``python scripts\u002Fsegmentation_sample.py --data_name ISIC --data_dir *输入数据路径* --out_dir *输出数据路径* --model_path *保存的模型* --image_size 256 --num_channels 128 --class_cond False --num_res_blocks 2 --num_heads 1 --learn_sigma True --use_scale_shift_norm False --attention_resolutions 16 --diffusion_steps 1000 --noise_schedule linear --rescale_learned_sigmas False --rescale_timesteps False --num_ensemble 5``\n\n4. 评估时，运行：``python scripts\u002Fsegmentation_env.py --inp_pth *保存预测图像的文件夹* --out_pth *保存真实标签图像的文件夹*``\n\n\n默认情况下，样本将保存在 `` .\u002Fresults\u002F`` \n### MRI 图像中的脑肿瘤分割\n1. 从 https:\u002F\u002Fwww.med.upenn.edu\u002Fcbica\u002Fbrats2020\u002Fdata.html 下载 BRATS2020 数据集。您的数据集文件夹应如下所示：\n~~~\ndata\n└───training\n│   └───slice0001\n│       │   brats_train_001_t1_123_w.nii.gz\n│       │   brats_train_001_t2_123_w.nii.gz\n│       │   brats_train_001_flair_123_w.nii.gz\n│       │   brats_train_001_t1ce_123_w.nii.gz\n│       │   brats_train_001_seg_123_w.nii.gz\n│   └───slice0002\n│       │  ...\n└───testing\n│   └───slice1000\n│       │  ...\n│   └───slice1001\n│       │  ...\n~~~\n    \n2. 训练时，运行：``python scripts\u002Fsegmentation_train.py --data_dir (您放置数据文件夹的位置)\u002Fdata\u002Ftraining --out_dir 输出数据路径 --image_size 256 --num_channels 128 --class_cond False --num_res_blocks 2 --num_heads 1 --learn_sigma True --use_scale_shift_norm False --attention_resolutions 16 --diffusion_steps 1000 --noise_schedule linear --rescale_learned_sigmas False --rescale_timesteps False --lr 1e-4 --batch_size 8``\n\n3. 采样时，运行：``python scripts\u002Fsegmentation_sample.py --data_dir (您放置数据文件夹的位置)\u002Fdata\u002Ftesting --out_dir 输出数据路径 --model_path 保存的模型 --image_size 256 --num_channels 128 --class_cond False --num_res_blocks 2 --num_heads 1 --learn_sigma True --use_scale_shift_norm False --attention_resolutions 16 --diffusion_steps 1000 --noise_schedule linear --rescale_learned_sigmas False --rescale_timesteps False --num_ensemble 5``\n\n\n### 其他示例\n...\n\n### 在您自己的数据集上运行\n在其他数据集上运行 MedSegDiff 非常简单。只需按照 `` .\u002Fguided_diffusion\u002Fisicloader.py`` 或 `` .\u002Fguided_diffusion\u002Fbratsloader.py`` 的格式编写另一个数据加载器文件即可。如果您遇到任何问题，欢迎提交 Issue。如果您能贡献自己的数据集扩展，我们将不胜感激。与自然图像不同，医学图像因任务不同而差异很大。要扩大方法的泛化能力，需要大家共同努力。\n## 超参数与训练建议\n要训练出一个优秀的模型，即论文中的 MedSegDiff-B，可将模型超参数设置为：\n~~~\n--image_size 256 --num_channels 128 --class_cond False --num_res_blocks 2 --num_heads 1 --learn_sigma True --use_scale_shift_norm False --attention_resolutions 16 \n~~~\n扩散超参数设置为：\n~~~\n--diffusion_steps 1000 --noise_schedule linear --rescale_learned_sigmas False --rescale_timesteps False\n~~~\n为了加快采样速度：\n~~~\n--diffusion_steps 50 --dpm_solver True \n~~~\n多 GPU 运行时：\n~~~\n--multi-gpu 0,1,2（例如）\n~~~\n训练超参数设置为：\n~~~\n--lr 5e-5 --batch_size 8\n~~~\n并在采样时设置 ``--num_ensemble 5``。\n\n在大多数数据集上，训练约 10 万步即可收敛。需要注意的是，尽管在后期的许多步骤中损失不再下降，但结果的质量仍在不断提升。这种现象在其他 DPM 应用中也有观察到，比如图像生成。希望有聪明人能告诉我这是为什么🥲。\n\n我很快会发布其在较小批量下的性能表现（适合在 24GB 显存的 GPU 上运行），以便进行对比🤗。\n\n要充分发挥其潜力的配置（MedSegDiff++）是：\n~~~\n--image_size 256 --num_channels 512 --class_cond False --num_res_blocks 12 --num_heads 8 --learn_sigma True --use_scale_shift_norm True --attention_resolutions 24 \n~~~\n然后使用批量 ``--batch_size 64`` 训练，并以集合数 ``--num_ensemble 25`` 进行采样。\n\n## 待办事项列表\n\n- [x] 修复 BRATS 中的 bug。添加 BRATS 示例。\n- [x] 发布 REFUGE 和 DDIT 数据加载器及示例。\n- [x] 使用 DPM 求解器加速采样。\n- [ ] 深度推理。\n- [x] 修复多 GPU 并行中的 bug。\n- [x] 在训练过程中进行采样并可视化。\n- [x] 发布预处理和后处理流程。\n- [x] 发布评估代码。\n- [x] 部署至 HuggingFace。\n- [x] 完成配置。\n\n## 感谢\n本代码大量借鉴了以下项目：[openai\u002Fimproved-diffusion](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fimproved-diffusion)、[WuJunde\u002FMrPrism](https:\u002F\u002Fgithub.com\u002FWuJunde\u002FMrPrism)、[WuJunde\u002FDiagnosisFirst](https:\u002F\u002Fgithub.com\u002FWuJunde\u002FDiagnosisFirst)、[LuChengTHU\u002Fdpm-solver](https:\u002F\u002Fgithub.com\u002FLuChengTHU\u002Fdpm-solver)、[JuliaWolleb\u002FDiffusion-based-Segmentation](https:\u002F\u002Fgithub.com\u002FJuliaWolleb\u002FDiffusion-based-Segmentation)、[hojonathanho\u002Fdiffusion](https:\u002F\u002Fgithub.com\u002Fhojonathanho\u002Fdiffusion)、[guided-diffusion](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fguided-diffusion)、[bigmb\u002FUnet-Segmentation-Pytorch-Nest-of-Unets](https:\u002F\u002Fgithub.com\u002Fbigmb\u002FUnet-Segmentation-Pytorch-Nest-of-Unets)、[nnUnet](https:\u002F\u002Fgithub.com\u002FMIC-DKFZ\u002FnnUNet)、[lucidrains\u002Fvit-pytorch](https:\u002F\u002Fgithub.com\u002Flucidrains\u002Fvit-pytorch)。\n## 引用\n请引用以下文献：\n~~~\n@inproceedings{wu2023medsegdiff,\n  title={MedSegDiff: 医学图像分割的扩散概率模型},\n  author={吴俊德、RAO、方慧慧、张宇、杨叶辉、熊浩义、刘慧英、徐延武},\n  booktitle={深度学习在医学影像中的应用},\n  year={2023}\n}\n~~~\n\n~~~\n@article{wu2023medsegdiff,\n  title={MedSegDiff-V2：基于 Transformer 的扩散式医学图像分割},\n  author={吴俊德、季伟、傅华珠、许敏、金月明、徐延武},\n  journal={arXiv 预印本 arXiv:2301.11798},\n  year={2023}\n}\n~~~","# MedSegDiff 快速上手指南\n\nMedSegDiff 是一个基于扩散概率模型（DPM）的框架，专为医学图像中的器官\u002F组织分割与重建而设计。支持 V1 基础版及最新的 V2（引入 Transformer 架构，精度更高、更稳定）。\n\n## 环境准备\n\n*   **系统要求**：Linux 或 macOS（推荐 Linux），需配备 NVIDIA GPU 以进行训练和加速采样。\n*   **前置依赖**：\n    *   Python 3.8+\n    *   PyTorch (兼容版本请参考 `requirement.txt`)\n    *   CUDA 工具包\n*   **数据集准备**：\n    *   **皮肤癌分割 (ISIC)**：从 [ISIC Archive](https:\u002F\u002Fchallenge.isic-archive.com\u002Fdata\u002F) 下载，目录结构需包含 `Train` 和 `Test` 文件夹及对应的 CSV 标签文件。\n    *   **脑肿瘤分割 (BraTS)**：从 [BraTS2020](https:\u002F\u002Fwww.med.upenn.edu\u002Fcbica\u002Fbrats2020\u002Fdata.html) 下载，需整理为 `.nii.gz` 格式的多模态 MRI 数据。\n\n## 安装步骤\n\n1.  克隆项目代码：\n    ```bash\n    git clone https:\u002F\u002Fgithub.com\u002FWuJunde\u002FMedSegDiff.git\n    cd MedSegDiff\n    ```\n\n2.  安装依赖包（建议配置国内镜像源加速）：\n    ```bash\n    pip install -r requirement.txt -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n    ```\n\n## 基本使用\n\n以下以 **ISIC 皮肤黑色素瘤分割** 为例，展示最核心的训练、采样与评估流程。请确保已按 README 要求整理好 `data\u002FISIC` 目录结构。\n\n### 1. 模型训练\n运行以下命令开始训练。默认使用最新发布的 V2 框架（更精准、资源占用合理）。若需使用旧版 V1，请添加 `--version 1` 参数。\n\n```bash\npython scripts\u002Fsegmentation_train.py \\\n  --data_name ISIC \\\n  --data_dir .\u002Fdata\u002FISIC \\\n  --out_dir .\u002Foutputs\u002Fisic_model \\\n  --image_size 256 \\\n  --num_channels 128 \\\n  --class_cond False \\\n  --num_res_blocks 2 \\\n  --num_heads 1 \\\n  --learn_sigma True \\\n  --use_scale_shift_norm False \\\n  --attention_resolutions 16 \\\n  --diffusion_steps 1000 \\\n  --noise_schedule linear \\\n  --rescale_learned_sigmas False \\\n  --rescale_timesteps False \\\n  --lr 1e-4 \\\n  --batch_size 8\n```\n> **提示**：通常训练约 100,000 步即可收敛。如需多卡训练，添加 `--multi-gpu 0,1,2,3`。\n\n### 2. 图像采样（推理）\n使用训练好的模型进行分割预测。推荐使用 **DPM-Solver** 将采样步数从 1000 步大幅减少至 20-50 步，显著提升速度。\n\n```bash\npython scripts\u002Fsegmentation_sample.py \\\n  --data_name ISIC \\\n  --data_dir .\u002Fdata\u002FISIC\u002FTest \\\n  --out_dir .\u002Fresults\u002Fisic_pred \\\n  --model_path .\u002Foutputs\u002Fisic_model\u002Fmodel_latest.pt \\\n  --image_size 256 \\\n  --num_channels 128 \\\n  --class_cond False \\\n  --num_res_blocks 2 \\\n  --num_heads 1 \\\n  --learn_sigma True \\\n  --use_scale_shift_norm False \\\n  --attention_resolutions 16 \\\n  --diffusion_steps 50 \\\n  --noise_schedule linear \\\n  --rescale_learned_sigmas False \\\n  --rescale_timesteps False \\\n  --dpm_solver True \\\n  --num_ensemble 5\n```\n> **参数说明**：\n> *   `--dpm_solver True`：启用快速采样算法。\n> *   `--num_ensemble 5`：集成采样次数，增加此值可提升结果稳定性。\n\n### 3. 结果评估\n计算预测结果与真实标签（Ground Truth）之间的指标（如 Dice Score 等）。\n\n```bash\npython scripts\u002Fsegmentation_env.py \\\n  --inp_pth .\u002Fresults\u002Fisic_pred \\\n  --out_pth .\u002Fdata\u002FISIC\u002FTest\u002FISBI2016_ISIC_Part1_Test_GroundTruth\n```\n\n---\n**其他数据集**：若要使用 BraTS 或其他自定义数据集，只需参照 `guided_diffusion\u002Fisicloader.py` 编写新的数据加载器，并调整上述命令中的 `--data_name` 和数据路径即可。","某三甲医院皮肤科科研团队正利用 ISIC 公开数据集训练黑色素瘤辅助诊断模型，旨在从复杂的皮肤镜图像中精准提取病灶区域以量化肿瘤负荷。\n\n### 没有 MedSegDiff 时\n- **边界模糊导致误判**：面对病灶与正常皮肤过渡柔和、边缘不清的图像，传统 CNN 模型常出现分割断裂或过度侵蚀，难以捕捉细微的浸润特征。\n- **小样本泛化能力弱**：在罕见亚型或标注数据稀缺的场景下，模型极易过拟合，导致在不同设备采集的图像上表现大幅波动，鲁棒性差。\n- **推理速度与精度难兼得**：为了提升对复杂纹理的识别率，往往需要堆叠更深的网络结构，导致显存占用高且推理延迟大，无法满足临床实时筛查需求。\n\n### 使用 MedSegDiff 后\n- **概率生成重塑精准边界**：借助扩散概率模型（DPM）的去噪特性，MedSegDiff 能逐步“还原”出连贯且解剖结构合理的病灶轮廓，显著提升了模糊边界的分割完整性。\n- **强泛化适应多域数据**：基于扩散过程的生成式学习机制，使其在少量标注样本下仍能学习到器官\u002F组织的本质分布，有效克服了跨中心、跨设备的数据域偏移问题。\n- **加速采样实现高效部署**：集成 DPM-Solver 技术后，将采样步数从 1000 步骤减至 20 步，在保持 SOTA 精度的同时实现了闪电般的推理速度，大幅降低了算力门槛。\n\nMedSegDiff 通过引入扩散模型范式，成功解决了医学图像中边界不确定与小样本学习的核心难题，为高精度、低资源的智能诊疗提供了可靠方案。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FImprintLab_MedSegDiff_d91337d1.png","ImprintLab","Imprint Lab","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FImprintLab_1f53a865.png","",null,"https:\u002F\u002Fgithub.com\u002FImprintLab",[80],{"name":81,"color":82,"percentage":83},"Python","#3572A5",100,1356,198,"2026-04-03T23:45:26","MIT","未说明","需要 NVIDIA GPU（支持多卡分布式训练），显存需求视配置而定：默认配置建议 8GB+，高性能配置 (MedSegDiff++) 需 24GB+",{"notes":91,"python":88,"dependencies":92},"1. 项目基于 OpenAI improved-diffusion 代码库，需安装 requirements.txt 中的依赖。2. 支持 DPM-Solver 加速采样，可将步数从 1000 减少到 20 步。3. 提供针对皮肤癌 (ISIC) 和脑肿瘤 (BRATS2020) 的专用数据加载器。4. 默认运行 V2 版本（更准确、稳定），如需运行 V1 需添加 '--version 1' 参数。5. 训练约 100,000 步可收敛。",[93,94,95,96,97],"torch","dpm-solver","transformers (MedSegDiff-V2)","nibabel (用于处理 BRATS .nii.gz 数据)","pandas (用于处理 CSV 标签)",[15,14],[100,101,102,103,104,105],"artificial-intelligence","deep-learning","denoising-diffusion","image-segmentation","medical-imaging","segmentation","2026-03-27T02:49:30.150509","2026-04-06T18:50:53.157510",[109,114,119,124,129,134],{"id":110,"question_zh":111,"answer_zh":112,"source_url":113},19734,"使用 DPM-Solver 进行采样时出现 CUDA 显存溢出（Out of Memory）错误，如何解决？","这是一个已知问题，通常由 PyTorch 版本兼容性或梯度图未分离引起。解决方案包括：\n1. 尝试将 PyTorch 版本降级至 1.8。\n2. 代码层面修复：维护者已通过将采样过程从梯度图中分离（detaching the sample out the gradient graph）解决了此问题。请拉取最新代码或检查相关提交记录应用该修复。","https:\u002F\u002Fgithub.com\u002FImprintLab\u002FMedSegDiff\u002Fissues\u002F49",{"id":115,"question_zh":116,"answer_zh":117,"source_url":118},19735,"运行训练脚本时报错 'ValueError: not enough values to unpack (expected 3, got 2)'，该如何修复？","该错误是因为数据集加载器返回的元组元素数量与训练循环期望的数量不匹配。对于 ISIC 数据集，需要修改 `guided_diffusion\u002Fisicloader.py` 文件中的返回语句。\n具体步骤：找到 `ISICDataset` 类，将返回语句从 `return (img, mask, name)` 修改为 `return (img, mask)`，即移除 `name` 字段。代码如下：\n```python\nif self.mode == 'Training':\n    return (img, mask)\nelse:\n    return (img, mask)\n```","https:\u002F\u002Fgithub.com\u002FImprintLab\u002FMedSegDiff\u002Fissues\u002F56",{"id":120,"question_zh":121,"answer_zh":122,"source_url":123},19736,"在 BraTS 数据集上运行时遇到 'IndexError: list index out of range' 或数据加载问题，原因是什么？","这通常是由于下载的数据集文件命名格式与代码预期不一致导致的。BraTS 原始数据的文件夹命名可能包含类似 `BraTS20_Training_001` 的前缀，而代码试图从中提取 `{flair, seg, t1, t1ce, t2}` 等关键字。\n解决方法：\n1. 检查下载的数据文件命名是否正确，部分文件可能存在命名错误。\n2. 编写脚本清洗数据或手动重命名文件以符合规范。\n3. 修改代码中解析文件名的逻辑，使其适配当前的文件命名格式（例如调整分割字符串的逻辑）。","https:\u002F\u002Fgithub.com\u002FImprintLab\u002FMedSegDiff\u002Fissues\u002F36",{"id":125,"question_zh":126,"answer_zh":127,"source_url":128},19737,"使用 DPM-Solver 训练时输出图像全黑或仅为噪声，且推理几步后显存溢出，是什么原因？","DPM-Solver 仅适用于采样（sampling\u002Finference）阶段，不应在训练（training）阶段启用。\n错误用法：在训练命令中添加 `--dpm_solver True` 会导致模型无法正确收敛，产生全黑或噪声图像。\n正确做法：\n1. 训练时保持默认设置（如 `--diffusion_steps 1000`），不要开启 `--dpm_solver`。\n2. 仅在推理\u002F采样阶段使用 `--diffusion_steps 50 --dpm_solver True` 来加速生成过程。","https:\u002F\u002Fgithub.com\u002FImprintLab\u002FMedSegDiff\u002Fissues\u002F100",{"id":130,"question_zh":131,"answer_zh":132,"source_url":133},19738,"在 ISIC 数据集上训练效果很差，推荐的超参数配置和预期结果是什么？","如果按照默认超参数训练效果不佳，建议参考以下社区验证的配置：\n1. 训练迭代次数（iterations）：建议运行至少 200,000 (20w) 步。\n2. 批次大小（batch size）：建议使用 24。\n在此配置下，预期的 Dice 系数约为 87.3%。如果结果仍不理想，请检查数据预处理是否正确以及是否训练了足够的步数。","https:\u002F\u002Fgithub.com\u002FImprintLab\u002FMedSegDiff\u002Fissues\u002F79",{"id":135,"question_zh":136,"answer_zh":137,"source_url":138},19739,"处理 BraTS 3D 体积数据时遇到 'leaf Variable requires grad in-place operation' 错误或维度不匹配，如何处理？","BraTS 数据是 3D 体积数据（h5 格式），而 MedSegDiff 主要设计用于 2D 切片处理。\n1. 数据预处理：需要在加载数据时将 3D 体积提取为 2D 切片。示例代码：\n```python\nfor index in range(volume.size(2)):\n    slice = volume[:,:,index,:,:]\n```\n2. 关于报错：确保在操作张量时避免原地操作（in-place operation）影响梯度计算。此外，注意 BraTS20 的数据格式可能与代码要求的 `t1, t1ce, t2, flair` 命名不一致，需自行修改 `bratsload.py` 或重命名文件以匹配键值。","https:\u002F\u002Fgithub.com\u002FImprintLab\u002FMedSegDiff\u002Fissues\u002F5",[]]