[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-microsoft--Bringing-Old-Photos-Back-to-Life":3,"tool-microsoft--Bringing-Old-Photos-Back-to-Life":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 真正成长为懂上",143909,2,"2026-04-07T11:33:18",[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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107888,"2026-04-06T11:32:50",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":76,"owner_email":77,"owner_twitter":78,"owner_website":79,"owner_url":80,"languages":81,"stars":94,"forks":95,"last_commit_at":96,"license":97,"difficulty_score":98,"env_os":99,"env_gpu":100,"env_ram":101,"env_deps":102,"category_tags":114,"github_topics":115,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":124,"updated_at":125,"faqs":126,"releases":159},5136,"microsoft\u002FBringing-Old-Photos-Back-to-Life","Bringing-Old-Photos-Back-to-Life","Bringing Old Photo Back to Life (CVPR 2020 oral)","Bringing-Old-Photos-Back-to-Life 是一款基于深度学习的开源项目，旨在让破损、模糊或褪色的老照片重新焕发清晰光彩。它不仅能修复划痕、噪点和物理损伤，还能对人脸区域进行高精度增强，恢复自然的肤色与细节，甚至支持高分辨率输入处理。\n\n该工具主要解决了传统图像修复算法在处理复杂老化痕迹时效果生硬、人脸失真严重等痛点。通过引入“深度潜在空间翻译”技术，它能够智能理解图像语义，在去噪和补全缺失部分的同时，保持整体画面的真实感与连贯性，避免了过度平滑或伪影的产生。\n\nBringing-Old-Photos-Back-to-Life 非常适合研究人员探索图像复原前沿算法，也适合开发者将其集成到各类影像处理应用中。虽然项目提供了 Colab 在线演示方便普通用户体验，但其核心代码更偏向学术研究与工程二次开发，需要一定的 Python 和 PyTorch 基础才能本地部署。作为曾入选 CVPR 2020 口头报告并后续发表于 TPAMI 期刊的成果，它在计算机视觉领域具有较高的参考价值，是连接学术创新与实际应用的优秀范例。","# Old Photo Restoration (Official PyTorch Implementation)\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_0d747af9812e.jpg'\u002F>\n\n### [Project Page](http:\u002F\u002Fraywzy.com\u002FOld_Photo\u002F) | [Paper (CVPR version)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2004.09484) | [Paper (Journal version)](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2009.07047v1.pdf) | [Pretrained Model](https:\u002F\u002Fhkustconnect-my.sharepoint.com\u002F:f:\u002Fg\u002Fpersonal\u002Fbzhangai_connect_ust_hk\u002FEm0KnYOeSSxFtp4g_dhWdf0BdeT3tY12jIYJ6qvSf300cA?e=nXkJH2) | [Colab Demo](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1NEm6AsybIiC5TwTU_4DqDkQO0nFRB-uA?usp=sharing)  | [Replicate Demo & Docker Image](https:\u002F\u002Freplicate.ai\u002Fzhangmozhe\u002Fbringing-old-photos-back-to-life) :fire:\n\n**Bringing Old Photos Back to Life, CVPR2020 (Oral)**\n\n**Old Photo Restoration via Deep Latent Space Translation, TPAMI 2022**\n\n[Ziyu Wan](http:\u002F\u002Fraywzy.com\u002F)\u003Csup>1\u003C\u002Fsup>,\n[Bo Zhang](https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fpeople\u002Fzhanbo\u002F)\u003Csup>2\u003C\u002Fsup>,\n[Dongdong Chen](http:\u002F\u002Fwww.dongdongchen.bid\u002F)\u003Csup>3\u003C\u002Fsup>,\n[Pan Zhang](https:\u002F\u002Fpanzhang0212.github.io\u002F)\u003Csup>4\u003C\u002Fsup>,\n[Dong Chen](https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fpeople\u002Fdoch\u002F)\u003Csup>2\u003C\u002Fsup>,\n[Jing Liao](https:\u002F\u002Fliaojing.github.io\u002Fhtml\u002F)\u003Csup>1\u003C\u002Fsup>,\n[Fang Wen](https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fpeople\u002Ffangwen\u002F)\u003Csup>2\u003C\u002Fsup> \u003Cbr>\n\u003Csup>1\u003C\u002Fsup>City University of Hong Kong, \u003Csup>2\u003C\u002Fsup>Microsoft Research Asia, \u003Csup>3\u003C\u002Fsup>Microsoft Cloud AI, \u003Csup>4\u003C\u002Fsup>USTC\n\n\u003C!-- ## Notes of this project\nThe code originates from our research project and the aim is to demonstrate the research idea, so we have not optimized it from a product perspective. And we will spend time to address some common issues, such as out of memory issue, limited resolution, but will not involve too much in engineering problems, such as speedup of the inference, fastapi deployment and so on. **We welcome volunteers to contribute to this project to make it more usable for practical application.** -->\n\n## :sparkles: News\n**2022.3.31**: Our new work regarding old film restoration will be published in CVPR 2022. For more details, please refer to the [project website](http:\u002F\u002Fraywzy.com\u002FOld_Film\u002F) and [github repo](https:\u002F\u002Fgithub.com\u002Fraywzy\u002FBringing-Old-Films-Back-to-Life).\n\nThe framework now supports the restoration of high-resolution input.\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_06f985adc446.png'>\n\nTraining code is available and welcome to have a try and learn the training details. \n\nYou can now play with our [Colab](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1NEm6AsybIiC5TwTU_4DqDkQO0nFRB-uA?usp=sharing) and try it on your photos. \n\n## Requirement\nThe code is tested on Ubuntu with Nvidia GPUs and CUDA installed. Python>=3.6 is required to run the code.\n\n## Installation\n\nClone the Synchronized-BatchNorm-PyTorch repository for\n\n```\ncd Face_Enhancement\u002Fmodels\u002Fnetworks\u002F\ngit clone https:\u002F\u002Fgithub.com\u002Fvacancy\u002FSynchronized-BatchNorm-PyTorch\ncp -rf Synchronized-BatchNorm-PyTorch\u002Fsync_batchnorm .\ncd ..\u002F..\u002F..\u002F\n```\n\n```\ncd Global\u002Fdetection_models\ngit clone https:\u002F\u002Fgithub.com\u002Fvacancy\u002FSynchronized-BatchNorm-PyTorch\ncp -rf Synchronized-BatchNorm-PyTorch\u002Fsync_batchnorm .\ncd ..\u002F..\u002F\n```\n\nDownload the landmark detection pretrained model\n\n```\ncd Face_Detection\u002F\nwget http:\u002F\u002Fdlib.net\u002Ffiles\u002Fshape_predictor_68_face_landmarks.dat.bz2\nbzip2 -d shape_predictor_68_face_landmarks.dat.bz2\ncd ..\u002F\n```\n\nDownload the pretrained model, put the file `Face_Enhancement\u002Fcheckpoints.zip` under `.\u002FFace_Enhancement`, and put the file `Global\u002Fcheckpoints.zip` under `.\u002FGlobal`. Then unzip them respectively.\n\n```\ncd Face_Enhancement\u002F\nwget https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FBringing-Old-Photos-Back-to-Life\u002Freleases\u002Fdownload\u002Fv1.0\u002Fface_checkpoints.zip\nunzip face_checkpoints.zip\ncd ..\u002F\ncd Global\u002F\nwget https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FBringing-Old-Photos-Back-to-Life\u002Freleases\u002Fdownload\u002Fv1.0\u002Fglobal_checkpoints.zip\nunzip global_checkpoints.zip\ncd ..\u002F\n```\n\nInstall dependencies:\n\n```bash\npip install -r requirements.txt\n```\n\n## :rocket: How to use?\n\n**Note**: GPU can be set 0 or 0,1,2 or 0,2; use -1 for CPU\n\n### 1) Full Pipeline\n\nYou could easily restore the old photos with one simple command after installation and downloading the pretrained model.\n\nFor images without scratches:\n\n```\npython run.py --input_folder [test_image_folder_path] \\\n              --output_folder [output_path] \\\n              --GPU 0\n```\n\nFor scratched images:\n\n```\npython run.py --input_folder [test_image_folder_path] \\\n              --output_folder [output_path] \\\n              --GPU 0 \\\n              --with_scratch\n```\n\n**For high-resolution images with scratches**:\n\n```\npython run.py --input_folder [test_image_folder_path] \\\n              --output_folder [output_path] \\\n              --GPU 0 \\\n              --with_scratch \\\n              --HR\n```\n\nNote: Please try to use the absolute path. The final results will be saved in `.\u002Foutput_path\u002Ffinal_output\u002F`. You could also check the produced results of different steps in `output_path`.\n\n### 2) Scratch Detection\n\nCurrently we don't plan to release the scratched old photos dataset with labels directly. If you want to get the paired data, you could use our pretrained model to test the collected images to obtain the labels.\n\n```\ncd Global\u002F\npython detection.py --test_path [test_image_folder_path] \\\n                    --output_dir [output_path] \\\n                    --input_size [resize_256|full_size|scale_256]\n```\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_900c2789e0d6.png'>\n\n### 3) Global Restoration\n\nA triplet domain translation network is proposed to solve both structured degradation and unstructured degradation of old photos.\n\n\u003Cp align=\"center\">\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_ef0017192d23.png' width=\"50%\" height=\"50%\"\u002F>\n\u003C\u002Fp>\n\n```\ncd Global\u002F\npython test.py --Scratch_and_Quality_restore \\\n               --test_input [test_image_folder_path] \\\n               --test_mask [corresponding mask] \\\n               --outputs_dir [output_path]\n\npython test.py --Quality_restore \\\n               --test_input [test_image_folder_path] \\\n               --outputs_dir [output_path]\n```\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_68fb4f919718.png'>\n\n\n### 4) Face Enhancement\n\nWe use a progressive generator to refine the face regions of old photos. More details could be found in our journal submission and `.\u002FFace_Enhancement` folder.\n\n\u003Cp align=\"center\">\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_9c86cad25306.jpg' width=\"60%\" height=\"60%\"\u002F>\n\u003C\u002Fp>\n\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_4e72f22547e2.png'>\n\n> *NOTE*: \n> This repo is mainly for research purpose and we have not yet optimized the running performance. \n> \n> Since the model is pretrained with 256*256 images, the model may not work ideally for arbitrary resolution.\n\n### 5) GUI\n\nA user-friendly GUI which takes input of image by user and shows result in respective window.\n\n#### How it works:\n\n1. Run GUI.py file.\n2. Click browse and select your image from test_images\u002Fold_w_scratch folder to remove scratches.\n3. Click Modify Photo button.\n4. Wait for a while and see results on GUI window.\n5. Exit window by clicking Exit Window and get your result image in output folder.\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_3af4e5b8a4f1.png'>\n\n## How to train?\n\n### 1) Create Training File\n\nPut the folders of VOC dataset, collected old photos (e.g., Real_L_old and Real_RGB_old) into one shared folder. Then\n```\ncd Global\u002Fdata\u002F\npython Create_Bigfile.py\n```\nNote: Remember to modify the code based on your own environment.\n\n### 2) Train the VAEs of domain A and domain B respectively\n\n```\ncd ..\npython train_domain_A.py --use_v2_degradation --continue_train --training_dataset domain_A --name domainA_SR_old_photos --label_nc 0 --loadSize 256 --fineSize 256 --dataroot [your_data_folder] --no_instance --resize_or_crop crop_only --batchSize 100 --no_html --gpu_ids 0,1,2,3 --self_gen --nThreads 4 --n_downsample_global 3 --k_size 4 --use_v2 --mc 64 --start_r 1 --kl 1 --no_cgan --outputs_dir [your_output_folder] --checkpoints_dir [your_ckpt_folder]\n\npython train_domain_B.py --continue_train --training_dataset domain_B --name domainB_old_photos --label_nc 0 --loadSize 256 --fineSize 256 --dataroot [your_data_folder]  --no_instance --resize_or_crop crop_only --batchSize 120 --no_html --gpu_ids 0,1,2,3 --self_gen --nThreads 4 --n_downsample_global 3 --k_size 4 --use_v2 --mc 64 --start_r 1 --kl 1 --no_cgan --outputs_dir [your_output_folder]  --checkpoints_dir [your_ckpt_folder]\n```\nNote: For the --name option, please ensure your experiment name contains \"domainA\" or \"domainB\", which will be used to select different dataset.\n\n### 3) Train the mapping network between domains\n\nTrain the mapping without scratches:\n```\npython train_mapping.py --use_v2_degradation --training_dataset mapping --use_vae_which_epoch 200 --continue_train --name mapping_quality --label_nc 0 --loadSize 256 --fineSize 256 --dataroot [your_data_folder] --no_instance --resize_or_crop crop_only --batchSize 80 --no_html --gpu_ids 0,1,2,3 --nThreads 8 --load_pretrainA [ckpt_of_domainA_SR_old_photos] --load_pretrainB [ckpt_of_domainB_old_photos] --l2_feat 60 --n_downsample_global 3 --mc 64 --k_size 4 --start_r 1 --mapping_n_block 6 --map_mc 512 --use_l1_feat --niter 150 --niter_decay 100 --outputs_dir [your_output_folder] --checkpoints_dir [your_ckpt_folder]\n```\n\n\nTraing the mapping with scraches:\n```\npython train_mapping.py --no_TTUR --NL_res --random_hole --use_SN --correlation_renormalize --training_dataset mapping --NL_use_mask --NL_fusion_method combine --non_local Setting_42 --use_v2_degradation --use_vae_which_epoch 200 --continue_train --name mapping_scratch --label_nc 0 --loadSize 256 --fineSize 256 --dataroot [your_data_folder] --no_instance --resize_or_crop crop_only --batchSize 36 --no_html --gpu_ids 0,1,2,3 --nThreads 8 --load_pretrainA [ckpt_of_domainA_SR_old_photos] --load_pretrainB [ckpt_of_domainB_old_photos] --l2_feat 60 --n_downsample_global 3 --mc 64 --k_size 4 --start_r 1 --mapping_n_block 6 --map_mc 512 --use_l1_feat --niter 150 --niter_decay 100 --outputs_dir [your_output_folder] --checkpoints_dir [your_ckpt_folder] --irregular_mask [absolute_path_of_mask_file]\n```\n\nTraing the mapping with scraches (Multi-Scale Patch Attention for HR input):\n```\npython train_mapping.py --no_TTUR --NL_res --random_hole --use_SN --correlation_renormalize --training_dataset mapping --NL_use_mask --NL_fusion_method combine --non_local Setting_42 --use_v2_degradation --use_vae_which_epoch 200 --continue_train --name mapping_Patch_Attention --label_nc 0 --loadSize 256 --fineSize 256 --dataroot [your_data_folder] --no_instance --resize_or_crop crop_only --batchSize 36 --no_html --gpu_ids 0,1,2,3 --nThreads 8 --load_pretrainA [ckpt_of_domainA_SR_old_photos] --load_pretrainB [ckpt_of_domainB_old_photos] --l2_feat 60 --n_downsample_global 3 --mc 64 --k_size 4 --start_r 1 --mapping_n_block 6 --map_mc 512 --use_l1_feat --niter 150 --niter_decay 100 --outputs_dir [your_output_folder] --checkpoints_dir [your_ckpt_folder] --irregular_mask [absolute_path_of_mask_file] --mapping_exp 1\n```\n\n\n## Citation\n\nIf you find our work useful for your research, please consider citing the following papers :)\n\n```bibtex\n@inproceedings{wan2020bringing,\ntitle={Bringing Old Photos Back to Life},\nauthor={Wan, Ziyu and Zhang, Bo and Chen, Dongdong and Zhang, Pan and Chen, Dong and Liao, Jing and Wen, Fang},\nbooktitle={Proceedings of the IEEE\u002FCVF Conference on Computer Vision and Pattern Recognition},\npages={2747--2757},\nyear={2020}\n}\n```\n\n```bibtex\n@article{wan2020old,\n  title={Old Photo Restoration via Deep Latent Space Translation},\n  author={Wan, Ziyu and Zhang, Bo and Chen, Dongdong and Zhang, Pan and Chen, Dong and Liao, Jing and Wen, Fang},\n  journal={arXiv preprint arXiv:2009.07047},\n  year={2020}\n}\n```\n\nIf you are also interested in the legacy photo\u002Fvideo colorization, please refer to [this work](https:\u002F\u002Fgithub.com\u002Fzhangmozhe\u002Fvideo-colorization).\n\n## Maintenance\n\nThis project is currently maintained by Ziyu Wan and is for academic research use only. If you have any questions, feel free to contact raywzy@gmail.com.\n\n## License\n\nThe codes and the pretrained model in this repository are under the MIT license as specified by the LICENSE file. We use our labeled dataset to train the scratch detection model.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https:\u002F\u002Fopensource.microsoft.com\u002Fcodeofconduct\u002F). For more information see the [Code of Conduct FAQ](https:\u002F\u002Fopensource.microsoft.com\u002Fcodeofconduct\u002Ffaq\u002F) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n","# 旧照片修复（官方 PyTorch 实现）\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_0d747af9812e.jpg'\u002F>\n\n### [项目页面](http:\u002F\u002Fraywzy.com\u002FOld_Photo\u002F) | [论文（CVPR 版）](https:\u002F\u002Farxiv.org\u002Fabs\u002F2004.09484) | [论文（期刊版）](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2009.07047v1.pdf) | [预训练模型](https:\u002F\u002Fhkustconnect-my.sharepoint.com\u002F:f:\u002Fg\u002Fpersonal\u002Fbzhangai_connect_ust_hk\u002FEm0KnYOeSSxFtp4g_dhWdf0BdeT3tY12jIYJ6qvSf300cA?e=nXkJH2) | [Colab 演示](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1NEm6AsybIiC5TwTU_4DqDkQO0nFRB-uA?usp=sharing)  | [Replicate 演示 & Docker 镜像](https:\u002F\u002Freplicate.ai\u002Fzhangmozhe\u002Fbringing-old-photos-back-to-life) :fire:\n\n**让旧照片重焕生机，CVPR2020（口头报告）**\n\n**基于深度潜在空间翻译的旧照片修复，TPAMI 2022**\n\n[Ziyu Wan](http:\u002F\u002Fraywzy.com\u002F)\u003Csup>1\u003C\u002Fsup>,\n[Bo Zhang](https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fpeople\u002Fzhanbo\u002F)\u003Csup>2\u003C\u002Fsup>,\n[Dongdong Chen](http:\u002F\u002Fwww.dongdongchen.bid\u002F)\u003Csup>3\u003C\u002Fsup>,\n[Pan Zhang](https:\u002F\u002Fpanzhang0212.github.io\u002F)\u003Csup>4\u003C\u002Fsup>,\n[Dong Chen](https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fpeople\u002Fdoch\u002F)\u003Csup>2\u003C\u002Fsup>,\n[Jing Liao](https:\u002F\u002Fliaojing.github.io\u002Fhtml\u002F)\u003Csup>1\u003C\u002Fsup>,\n[Fang Wen](https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fresearch\u002Fpeople\u002Ffangwen\u002F)\u003Csup>2\u003C\u002Fsup> \u003Cbr>\n\u003Csup>1\u003C\u002Fsup>香港城市大学, \u003Csup>2\u003C\u002Fsup>微软亚洲研究院, \u003Csup>3\u003C\u002Fsup>微软云人工智能, \u003Csup>4\u003C\u002Fsup>中国科学技术大学\n\n\u003C!-- ## 本项目的说明\n代码源自我们的研究项目，旨在展示研究思路，因此我们并未从产品角度进行优化。我们会花时间解决一些常见问题，例如显存不足、分辨率限制等，但不会过多涉及工程化问题，比如推理加速、FastAPI 部署等。**我们欢迎志愿者为该项目贡献力量，使其更适用于实际应用。** -->\n\n## :sparkles: 最新消息\n**2022年3月31日**：我们关于老电影修复的新工作将在 CVPR 2022 上发表。更多详情请参阅 [项目网站](http:\u002F\u002Fraywzy.com\u002FOld_Film\u002F) 和 [GitHub 仓库](https:\u002F\u002Fgithub.com\u002Fraywzy\u002FBringing-Old-Films-Back-to-Life)。\n\n该框架现已支持高分辨率输入的修复。\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_06f985adc446.png'>\n\n训练代码已开放，欢迎大家尝试并学习训练细节。\n\n现在您可以通过我们的 [Colab](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1NEm6AsybIiC5TwTU_4DqDkQO0nFRB-uA?usp=sharing) 直接在自己的照片上试用。\n\n## 系统要求\n代码已在安装了 Nvidia GPU 和 CUDA 的 Ubuntu 系统上测试通过。运行代码需要 Python>=3.6。\n\n## 安装\n\n克隆 Synchronized-BatchNorm-PyTorch 仓库以获取同步批归一化模块：\n\n```\ncd Face_Enhancement\u002Fmodels\u002Fnetworks\u002F\ngit clone https:\u002F\u002Fgithub.com\u002Fvacancy\u002FSynchronized-BatchNorm-PyTorch\ncp -rf Synchronized-BatchNorm-PyTorch\u002Fsync_batchnorm .\ncd ..\u002F..\u002F..\u002F\n```\n\n```\ncd Global\u002Fdetection_models\ngit clone https:\u002F\u002Fgithub.com\u002Fvacancy\u002FSynchronized-BatchNorm-PyTorch\ncp -rf Synchronized-BatchNorm-PyTorch\u002Fsync_batchnorm .\ncd ..\u002F..\u002F\n```\n\n下载地标检测预训练模型：\n\n```\ncd Face_Detection\u002F\nwget http:\u002F\u002Fdlib.net\u002Ffiles\u002Fshape_predictor_68_face_landmarks.dat.bz2\nbzip2 -d shape_predictor_68_face_landmarks.dat.bz2\ncd ..\u002F\n```\n\n下载预训练模型，将 `Face_Enhancement\u002Fcheckpoints.zip` 文件放入 `.\u002FFace_Enhancement` 目录下，将 `Global\u002Fcheckpoints.zip` 文件放入 `.\u002FGlobal` 目录下，然后分别解压。\n\n```\ncd Face_Enhancement\u002F\nwget https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FBringing-Old-Photos-Back-to-Life\u002Freleases\u002Fdownload\u002Fv1.0\u002Fface_checkpoints.zip\nunzip face_checkpoints.zip\ncd ..\u002F\ncd Global\u002F\nwget https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FBringing-Old-Photos-Back-to-Life\u002Freleases\u002Fdownload\u002Fv1.0\u002Fglobal_checkpoints.zip\nunzip global_checkpoints.zip\ncd ..\u002F\n```\n\n安装依赖：\n\n```bash\npip install -r requirements.txt\n```\n\n## :rocket: 使用方法？\n\n**注意**：GPU 可设置为 0 或 0,1,2 或 0,2；使用 -1 表示 CPU。\n\n### 1) 全流程\n\n安装并下载预训练模型后，只需一条简单命令即可轻松修复旧照片。\n\n对于无划痕的图像：\n\n```\npython run.py --input_folder [测试图像文件夹路径] \\\n              --output_folder [输出路径] \\\n              --GPU 0\n```\n\n对于有划痕的图像：\n\n```\npython run.py --input_folder [测试图像文件夹路径] \\\n              --output_folder [输出路径] \\\n              --GPU 0 \\\n              --with_scratch\n```\n\n**对于带有划痕的高分辨率图像**：\n\n```\npython run.py --input_folder [测试图像文件夹路径] \\\n              --output_folder [输出路径] \\\n              --GPU 0 \\\n              --with_scratch \\\n              --HR\n```\n\n注意：请尽量使用绝对路径。最终结果将保存在 `.\u002Foutput_path\u002Ffinal_output\u002F` 中。您也可以在 `output_path` 中查看各步骤的中间结果。\n\n### 2) 划痕检测\n\n目前我们暂不计划直接发布带标签的旧照片划痕数据集。如果您希望获得配对数据，可以使用我们的预训练模型对收集到的图像进行测试，从而获取标签。\n\n```\ncd Global\u002F\npython detection.py --test_path [测试图像文件夹路径] \\\n                    --output_dir [输出路径] \\\n                    --input_size [resize_256|full_size|scale_256]\n```\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_900c2789e0d6.png'>\n\n### 3) 全局修复\n\n我们提出了一种三元域转换网络，用于同时解决旧照片中的结构化退化和非结构化退化问题。\n\n\u003Cp align=\"center\">\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_ef0017192d23.png' width=\"50%\" height=\"50%\"\u002F>\n\u003C\u002Fp>\n\n```\ncd Global\u002F\npython test.py --Scratch_and_Quality_restore \\\n               --test_input [测试图像文件夹路径] \\\n               --test_mask [对应掩码] \\\n               --outputs_dir [输出路径]\n\npython test.py --Quality_restore \\\n               --test_input [测试图像文件夹路径] \\\n               --outputs_dir [输出路径]\n```\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_68fb4f919718.png'>\n\n\n### 4) 人脸增强\n\n我们使用渐进式生成器来细化旧照片中的人脸区域。更多细节请参阅我们的期刊投稿以及 `.\u002FFace_Enhancement` 文件夹。\n\n\u003Cp align=\"center\">\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_9c86cad25306.jpg' width=\"60%\" height=\"60%\"\u002F>\n\u003C\u002Fp>\n\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_4e72f22547e2.png'>\n\n> *注*：\n> 此仓库主要用于研究目的，我们尚未优化运行性能。\n> \n> 由于模型是基于 256*256 分辨率的图像预训练的，因此对于任意分辨率的图像，模型可能无法达到理想效果。\n\n### 5) GUI 界面\n\n一个用户友好的图形界面，允许用户输入图像并在相应窗口中显示结果。\n\n#### 使用方法：\n\n1. 运行 GUI.py 文件。\n2. 点击“浏览”按钮，从 test_images\u002Fold_w_scratch 文件夹中选择您的图像以去除划痕。\n3. 点击“修改照片”按钮。\n4. 等待片刻，即可在 GUI 窗口中看到结果。\n5. 点击“退出窗口”按钮关闭窗口，并在输出文件夹中获取您的结果图像。\n\n\u003Cimg src='https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_readme_3af4e5b8a4f1.png'>\n\n## 如何训练？\n\n### 1) 创建训练文件\n\n将 VOC 数据集的文件夹以及收集的旧照片（例如 Real_L_old 和 Real_RGB_old）放入一个共享文件夹中。然后执行以下命令：\n```\ncd Global\u002Fdata\u002F\npython Create_Bigfile.py\n```\n注意：请根据您自己的环境修改代码。\n\n### 2) 分别训练域 A 和域 B 的 VAE\n\n```\ncd ..\npython train_domain_A.py --use_v2_degradation --continue_train --training_dataset domain_A --name domainA_SR_old_photos --label_nc 0 --loadSize 256 --fineSize 256 --dataroot [your_data_folder] --no_instance --resize_or_crop crop_only --batchSize 100 --no_html --gpu_ids 0,1,2,3 --self_gen --nThreads 4 --n_downsample_global 3 --k_size 4 --use_v2 --mc 64 --start_r 1 --kl 1 --no_cgan --outputs_dir [your_output_folder] --checkpoints_dir [your_ckpt_folder]\n\npython train_domain_B.py --continue_train --training_dataset domain_B --name domainB_old_photos --label_nc 0 --loadSize 256 --fineSize 256 --dataroot [your_data_folder]  --no_instance --resize_or_crop crop_only --batchSize 120 --no_html --gpu_ids 0,1,2,3 --self_gen --nThreads 4 --n_downsample_global 3 --k_size 4 --use_v2 --mc 64 --start_r 1 --kl 1 --no_cgan --outputs_dir [your_output_folder]  --checkpoints_dir [your_ckpt_folder]\n```\n注意：对于 --name 参数，请确保您的实验名称包含 \"domainA\" 或 \"domainB\"，这将用于选择不同的数据集。\n\n### 3) 训练域间映射网络\n\n训练无划痕的映射：\n```\npython train_mapping.py --use_v2_degradation --training_dataset mapping --use_vae_which_epoch 200 --continue_train --name mapping_quality --label_nc 0 --loadSize 256 --fineSize 256 --dataroot [your_data_folder] --no_instance --resize_or_crop crop_only --batchSize 80 --no_html --gpu_ids 0,1,2,3 --nThreads 8 --load_pretrainA [ckpt_of_domainA_SR_old_photos] --load_pretrainB [ckpt_of_domainB_old_photos] --l2_feat 60 --n_downsample_global 3 --mc 64 --k_size 4 --start_r 1 --mapping_n_block 6 --map_mc 512 --use_l1_feat --niter 150 --niter_decay 100 --outputs_dir [your_output_folder] --checkpoints_dir [your_ckpt_folder]\n```\n\n\n训练带划痕的映射：\n```\npython train_mapping.py --no_TTUR --NL_res --random_hole --use_SN --correlation_renormalize --training_dataset mapping --NL_use_mask --NL_fusion_method combine --non_local Setting_42 --use_v2_degradation --use_vae_which_epoch 200 --continue_train --name mapping_scratch --label_nc 0 --loadSize 256 --fineSize 256 --dataroot [your_data_folder] --no_instance --resize_or_crop crop_only --batchSize 36 --no_html --gpu_ids 0,1,2,3 --nThreads 8 --load_pretrainA [ckpt_of_domainA_SR_old_photos] --load_pretrainB [ckpt_of_domainB_old_photos] --l2_feat 60 --n_downsample_global 3 --mc 64 --k_size 4 --start_r 1 --mapping_n_block 6 --map_mc 512 --use_l1_feat --niter 150 --niter_decay 100 --outputs_dir [your_output_folder] --checkpoints_dir [your_ckpt_folder] --irregular_mask [absolute_path_of_mask_file]\n```\n\n训练带划痕的映射（针对高分辨率输入的多尺度补丁注意力）：\n```\npython train_mapping.py --no_TTUR --NL_res --random_hole --use_SN --correlation_renormalize --training_dataset mapping --NL_use_mask --NL_fusion_method combine --non_local Setting_42 --use_v2_degradation --use_vae_which_epoch 200 --continue_train --name mapping_Patch_Attention --label_nc 0 --loadSize 256 --fineSize 256 --dataroot [your_data_folder] --no_instance --resize_or_crop crop_only --batchSize 36 --no_html --gpu_ids 0,1,2,3 --nThreads 8 --load_pretrainA [ckpt_of_domainA_SR_old_photos] --load_pretrainB [ckpt_of_domainB_old_photos] --l2_feat 60 --n_downsample_global 3 --mc 64 --k_size 4 --start_r 1 --mapping_n_block 6 --map_mc 512 --use_l1_feat --niter 150 --niter_decay 100 --outputs_dir [your_output_folder] --checkpoints_dir [your_ckpt_folder] --irregular_mask [absolute_path_of_mask_file] --mapping_exp 1\n```\n\n\n## 引用\n\n如果您发现我们的工作对您的研究有所帮助，请考虑引用以下论文 :)\n\n```bibtex\n@inproceedings{wan2020bringing,\ntitle={Bringing Old Photos Back to Life},\nauthor={Wan, Ziyu and Zhang, Bo and Chen, Dongdong and Zhang, Pan and Chen, Dong and Liao, Jing and Wen, Fang},\nbooktitle={Proceedings of the IEEE\u002FCVF Conference on Computer Vision and Pattern Recognition},\npages={2747--2757},\nyear={2020}\n}\n```\n\n```bibtex\n@article{wan2020old,\n  title={Old Photo Restoration via Deep Latent Space Translation},\n  author={Wan, Ziyu and Zhang, Bo and Chen, Dongdong and Zhang, Pan and Chen, Dong and Liao, Jing and Wen, Fang},\n  journal={arXiv preprint arXiv:2009.07047},\n  year={2020}\n}\n```\n\n如果您也对老照片\u002F视频的上色感兴趣，请参阅[这项工作](https:\u002F\u002Fgithub.com\u002Fzhangmozhe\u002Fvideo-colorization)。\n\n## 维护\n\n该项目目前由 Ziyu Wan 维护，仅供学术研究使用。如有任何问题，请随时联系 raywzy@gmail.com。\n\n## 许可证\n\n本仓库中的代码和预训练模型均采用 MIT 许可证，具体见 LICENSE 文件。我们使用自有标注数据集来训练划痕检测模型。\n\n本项目已采纳 [Microsoft 开源行为准则](https:\u002F\u002Fopensource.microsoft.com\u002Fcodeofconduct\u002F)。更多信息请参阅 [行为准则常见问题解答](https:\u002F\u002Fopensource.microsoft.com\u002Fcodeofconduct\u002Ffaq\u002F)，或通过 [opencode@microsoft.com](mailto:opencode@microsoft.com) 联系我们，提出任何其他问题或意见。","# Bringing-Old-Photos-Back-to-Life 快速上手指南\n\n本指南帮助开发者快速部署并使用该工具修复老照片（去划痕、增强画质、人脸修复）。\n\n## 环境准备\n\n在开始之前，请确保您的系统满足以下要求：\n\n*   **操作系统**: Linux (推荐 Ubuntu)\n*   **硬件**: NVIDIA GPU (已安装 CUDA 驱动)\n*   **软件依赖**:\n    *   Python >= 3.6\n    *   Git\n    *   pip\n\n> **注意**：代码主要在 Ubuntu + Nvidia GPU 环境下测试通过。虽然支持 CPU 运行（使用 `-1` 参数），但推理速度会非常慢，强烈建议使用 GPU。\n\n## 安装步骤\n\n### 1. 克隆项目并安装基础依赖\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FBringing-Old-Photos-Back-to-Life.git\ncd Bringing-Old-Photos-Back-to-Life\npip install -r requirements.txt\n```\n*(国内用户若下载依赖缓慢，可添加 `-i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple` 使用清华源)*\n\n### 2. 安装同步批归一化模块 (Synchronized-BatchNorm)\n\n需要分别在两个目录下克隆并配置该模块：\n\n```bash\n# 配置 Face_Enhancement 模块\ncd Face_Enhancement\u002Fmodels\u002Fnetworks\u002F\ngit clone https:\u002F\u002Fgithub.com\u002Fvacancy\u002FSynchronized-BatchNorm-PyTorch\ncp -rf Synchronized-BatchNorm-PyTorch\u002Fsync_batchnorm .\ncd ..\u002F..\u002F..\u002F\n\n# 配置 Global 模块\ncd Global\u002Fdetection_models\ngit clone https:\u002F\u002Fgithub.com\u002Fvacancy\u002FSynchronized-BatchNorm-PyTorch\ncp -rf Synchronized-BatchNorm-PyTorch\u002Fsync_batchnorm .\ncd ..\u002F..\u002F\n```\n\n### 3. 下载人脸关键点检测模型\n\n```bash\ncd Face_Detection\u002F\nwget http:\u002F\u002Fdlib.net\u002Ffiles\u002Fshape_predictor_68_face_landmarks.dat.bz2\nbzip2 -d shape_predictor_68_face_landmarks.dat.bz2\ncd ..\u002F\n```\n*(若 `dlib.net` 下载失败，请自行搜索该文件 `shape_predictor_68_face_landmarks.dat` 并放入 `Face_Detection\u002F` 目录)*\n\n### 4. 下载预训练模型\n\n下载检查点文件并解压到对应目录：\n\n```bash\n# 下载并解压人脸增强模型\ncd Face_Enhancement\u002F\nwget https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FBringing-Old-Photos-Back-to-Life\u002Freleases\u002Fdownload\u002Fv1.0\u002Fface_checkpoints.zip\nunzip face_checkpoints.zip\ncd ..\u002F\n\n# 下载并解压全局修复模型\ncd Global\u002F\nwget https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FBringing-Old-Photos-Back-to-Life\u002Freleases\u002Fdownload\u002Fv1.0\u002Fglobal_checkpoints.zip\nunzip global_checkpoints.zip\ncd ..\u002F\n```\n*(若 GitHub 下载速度慢，建议手动在浏览器下载上述 zip 文件后上传至服务器对应目录)*\n\n## 基本使用\n\n安装完成后，即可通过一条命令修复照片。请准备好包含老照片的文件夹。\n\n**参数说明**：\n*   `--input_folder`: 输入图片文件夹路径（建议使用绝对路径）\n*   `--output_folder`: 输出结果文件夹路径\n*   `--GPU`: 指定 GPU 编号（如 `0` 或 `0,1`），若使用 CPU 则设为 `-1`\n\n### 场景 1：修复无划痕的老照片（仅画质增强）\n\n```bash\npython run.py --input_folder [test_image_folder_path] \\\n              --output_folder [output_path] \\\n              --GPU 0\n```\n\n### 场景 2：修复有划痕的老照片\n\n```bash\npython run.py --input_folder [test_image_folder_path] \\\n              --output_folder [output_path] \\\n              --GPU 0 \\\n              --with_scratch\n```\n\n### 场景 3：修复高分辨率且有划痕的老照片\n\n```bash\npython run.py --input_folder [test_image_folder_path] \\\n              --output_folder [output_path] \\\n              --GPU 0 \\\n              --with_scratch \\\n              --HR\n```\n\n**结果查看**：\n最终修复完成的图片将保存在 `[output_path]\u002Ffinal_output\u002F` 目录下。中间处理步骤的结果也可在 `[output_path]` 中查看。","一位家族史研究者正在整理一批 20 世纪初的移民家庭相册，这些照片因年代久远出现了严重的划痕、褪色和人脸模糊，急需修复以用于即将举办的社区展览。\n\n### 没有 Bringing-Old-Photos-Back-to-Life 时\n- 手工修复效率极低，专业修图师处理一张严重受损照片需耗时数小时，难以应对数百张的批量需求。\n- 传统滤镜只能简单锐化或调色，无法智能填补大面积划痕，导致照片细节丢失或产生不自然的伪影。\n- 人脸部分模糊不清时，缺乏基于深度学习的重建能力，无法恢复五官特征，使得人物身份难以辨认。\n- 高分辨率扫描后的图像在处理时常因显存不足而崩溃，缺乏针对大图优化的推理流程。\n- 修复结果往往需要反复调整参数，缺乏端到端的自动化流水线，非专业人士难以上手操作。\n\n### 使用 Bringing-Old-Photos-Back-to-Life 后\n- 利用预训练模型实现自动化批量处理，将单张照片的修复时间从小时级缩短至分钟级，大幅提升整理效率。\n- 通过深度潜在空间翻译技术，智能识别并去除复杂划痕与噪点，同时自然还原背景纹理，避免画面失真。\n- 专属的人脸增强模块能精准重建模糊的五官细节，让百年前的祖先面容重新清晰可辨，赋予照片情感价值。\n- 框架支持高分辨率输入优化，有效解决大尺寸老照片处理时的显存溢出问题，确保输出画质细腻清晰。\n- 提供从检测、修复到增强的完整全流程脚本，用户只需一条命令即可完成复杂修复，降低了技术门槛。\n\nBringing-Old-Photos-Back-to-Life 将原本高不可攀的专业影像修复工作转化为可大规模执行的自动化流程，让尘封的历史记忆得以高清重现。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Bringing-Old-Photos-Back-to-Life_0d747af9.jpg","microsoft","Microsoft","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fmicrosoft_4900709c.png","Open source projects and samples from Microsoft",null,"opensource@microsoft.com","OpenAtMicrosoft","https:\u002F\u002Fopensource.microsoft.com","https:\u002F\u002Fgithub.com\u002Fmicrosoft",[82,86,90],{"name":83,"color":84,"percentage":85},"Python","#3572A5",99.4,{"name":87,"color":88,"percentage":89},"Dockerfile","#384d54",0.4,{"name":91,"color":92,"percentage":93},"Shell","#89e051",0.2,15695,2091,"2026-04-07T00:00:14","MIT",4,"Linux (Ubuntu)","必需 NVIDIA GPU。README 未明确指定具体型号和显存大小，但提到存在显存不足（out of memory）的问题，且支持高分辨率输入，建议配备较大显存（如 8GB+）。CUDA 需已安装，具体版本未说明。","未说明",{"notes":103,"python":104,"dependencies":105},"1. 代码主要在 Ubuntu 系统上测试过，Windows 或 macOS 用户可能需要自行解决兼容性问题。\n2. 安装过程需要手动克隆 'Synchronized-BatchNorm-PyTorch' 仓库并复制文件到指定目录。\n3. 需要单独下载 dlib 的人脸 landmark 预训练模型。\n4. 需要下载 Face_Enhancement 和 Global 两个模块的预训练权重文件（checkpoints.zip）并解压。\n5. 项目主要面向学术研究，未针对产品化进行性能优化，推理速度可能较慢。\n6. 默认模型基于 256x256 分辨率训练，处理任意分辨率图片效果可能不理想，但框架已更新支持高分辨率输入（需添加 --HR 参数）。",">=3.6",[106,107,108,109,110,111,112,113],"torch","torchvision","numpy","opencv-python","Pillow","scikit-image","dlib","tqdm",[15,14],[116,117,118,119,120,121,122,123],"image-restoration","old-photo-restoration","generative-adversarial-network","gans","pytorch","image-manipulation","photo-restoration","photos","2026-03-27T02:49:30.150509","2026-04-08T01:10:07.951685",[127,132,137,141,146,150,155],{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},23308,"遇到 'RuntimeError: CUDA out of memory' 显存不足错误怎么办？","项目已重新设计网络以支持高分辨率图像。请尝试在运行代码时添加 `--HR` 参数。具体命令如下：\npython run.py --input_folder [测试图片文件夹路径] \\\n              --output_folder [输出路径] \\\n              --GPU 0 \\\n              --with_scratch \\\n              --HR\n此外，也可以尝试修改 run.py 中的 test_mode 为 Scale 模式来减少内存占用。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FBringing-Old-Photos-Back-to-Life\u002Fissues\u002F19",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},23309,"如何在 Windows 10 上安装和使用该软件？","如果您已经安装了 Python、Anaconda、PyTorch 和 Nvidia CUDA，建议直接运行提供的 Notebook 文件。请务必从 Notebook 的第一个单元格开始顺序执行所有单元格，因为这些单元格负责设置运行算法所需的环境。不要跳过前面的环境配置步骤直接运行恢复部分。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FBringing-Old-Photos-Back-to-Life\u002Fissues\u002F36",{"id":138,"question_zh":139,"answer_zh":140,"source_url":136},23310,"运行时报错 'FileNotFoundError: No such file or directory' 找不到输出文件怎么办？","这通常是因为没有完整执行环境初始化步骤导致的。请确保您是从 Notebook 的最开始处运行所有单元格。前面的单元格负责建立环境和生成必要的中间文件，如果跳过它们，后续步骤会因为找不到路径或文件而报错。",{"id":142,"question_zh":143,"answer_zh":144,"source_url":145},23311,"遇到 'cuDNN error: CUDNN_STATUS_INTERNAL_ERROR' 或 'illegal memory access' 错误如何解决？","这通常与 CUDA 或 cuDNN 的安装配置有关，也可能是显存问题。\n1. 参考 PyTorch 官方相关议题排查环境：pytorch\u002Fpytorch#22050 或 pytorch\u002Fpytorch#45769。\n2. 确保能成功运行官方提供的复现代码片段。\n3. 如果没有英伟达显卡或显存不足，可以强制使用 CPU 计算。确保 Python 版本为 3.8.x 以上，并执行以下命令（通过设置 --GPU -1 关闭 GPU）：\npython3 run.py --input_folder \u003C输入文件夹路径> --output_folder \u003C输出路径> --GPU -1 --HR","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FBringing-Old-Photos-Back-to-Life\u002Fissues\u002F66",{"id":147,"question_zh":148,"answer_zh":149,"source_url":145},23312,"如何检查是否是 Embedding 层导致的显存或内部错误？","如果使用了 nn.Embedding 层，请检查输入的 class id 是否在构建网络时设置的类别范围内。例如，如果设置为 nn.Embedding(10, 128)，那么计算时的 label id 必须小于 10，不能大于或等于 10，否则会导致非法内存访问错误。",{"id":151,"question_zh":152,"answer_zh":153,"source_url":154},23313,"训练代码中的 'build_mapping_models' 是什么？","这是用于构建映射模型的函数，通常包含 mapping_net（映射网络）、vgg（用于感知损失的预训练网络）以及对应的优化器 optimizer_mapping。具体实现细节请参考项目最新更新的训练代码部分。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FBringing-Old-Photos-Back-to-Life\u002Fissues\u002F81",{"id":156,"question_zh":157,"answer_zh":158,"source_url":154},23314,"项目是否提供了训练代码？","是的，训练代码已经添加到项目中。用户可以查看最新的代码库以了解详细的训练流程和参数设置。",[160],{"id":161,"version":162,"summary_zh":163,"released_at":164},139513,"v1.0","发布完整模型，附带完整的训练代码和Colab演示。支持高分辨率照片修复。","2021-07-12T12:11:32"]