[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"tool-mahmoudnafifi--Deep_White_Balance":3,"similar-mahmoudnafifi--Deep_White_Balance":115},{"id":4,"github_repo":5,"name":6,"description_en":7,"description_zh":8,"ai_summary_zh":8,"readme_en":9,"readme_zh":10,"quickstart_zh":11,"use_case_zh":12,"hero_image_url":13,"owner_login":14,"owner_name":15,"owner_avatar_url":16,"owner_bio":17,"owner_company":18,"owner_location":19,"owner_email":18,"owner_twitter":14,"owner_website":20,"owner_url":21,"languages":22,"stars":31,"forks":32,"last_commit_at":33,"license":34,"difficulty_score":35,"env_os":36,"env_gpu":37,"env_ram":36,"env_deps":38,"category_tags":52,"github_topics":54,"view_count":74,"oss_zip_url":18,"oss_zip_packed_at":18,"status":75,"created_at":76,"updated_at":77,"faqs":78,"releases":114},6585,"mahmoudnafifi\u002FDeep_White_Balance","Deep_White_Balance","Reference code for the paper: Deep White-Balance Editing (CVPR 2020). Our method is a deep learning multi-task framework for white-balance editing.","Deep_White_Balance 是 CVPR 2020 会议口头报告论文《Deep White-Balance Editing》的官方开源实现，由三星人工智能中心与约克大学联合研发。它主要解决数码摄影中常见的白平衡失衡问题，即照片因环境光线影响而出现偏色（如过黄或过蓝），导致色彩还原不准确。\n\n与传统仅能自动校正白平衡的方法不同，Deep_White_Balance 基于深度学习多任务框架，不仅能自动将图像调整至中性白平衡，还支持用户进行交互式编辑，灵活控制画面的冷暖色调风格。其核心技术亮点在于利用渲染生成的白平衡数据集进行训练，并通过端到端的神经网络架构，在保持图像细节的同时实现高质量的颜色迁移与校正。\n\n该项目提供了成熟的 MATLAB 和 PyTorch 版本代码，包含完整的训练脚本、单图处理示例以及直观的图形界面（GUI）演示。因此，它非常适合计算机视觉领域的研究人员复现算法、开发者集成色彩校正功能，以及摄影师或设计师用于辅助后期调色工作。虽然普通用户也可通过 GUI 体验功能，但整体使用门槛仍偏向具备一定技术背景的专业人群。","# Deep White-Balance Editing, CVPR 2020 (Oral)\n\n*[Mahmoud Afifi](https:\u002F\u002Fsites.google.com\u002Fview\u002Fmafifi)*\u003Csup>1,2\u003C\u002Fsup> and *[Michael S. Brown](http:\u002F\u002Fwww.cse.yorku.ca\u002F~mbrown\u002F)*\u003Csup>1\u003C\u002Fsup>\n\n\u003Csup>1\u003C\u002Fsup>Samsung AI Center (SAIC) - Toronto\n\n\u003Csup>2\u003C\u002Fsup>York University  \n\n\n\n[Oral presentation](https:\u002F\u002Fyoutu.be\u002Fb2u705wZOvU) \n\n\n\n![deep_WB_fig](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_1efaa43232a7.jpg)\n\nReference code for the paper [Deep White-Balance Editing.](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_CVPR_2020\u002Fpapers\u002FAfifi_Deep_White-Balance_Editing_CVPR_2020_paper.pdf) Mahmoud Afifi and Michael S. Brown, CVPR 2020. If you use this code or our dataset, please cite our paper:\n```\n@inproceedings{afifi2020deepWB,\n  title={Deep White-Balance Editing},\n  author={Afifi, Mahmoud and Brown, Michael S},\n  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},\n  year={2020}\n}\n```\n\n![network](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_3abaf7894a52.jpg)\n\n## Training data\n\n1. Download the [Rendered WB dataset](http:\u002F\u002Fcvil.eecs.yorku.ca\u002Fprojects\u002Fpublic_html\u002FsRGB_WB_correction\u002Fdataset.html).\n\n2. Copy both input images and ground-truth images in a single directory. Each pair of input\u002Fground truth images should be in the following format: input image: `name_WB_picStyle.png` and the corresponding ground truth image: `name_G_AS.png`. This is the same filename style used in the [Rendered WB dataset](http:\u002F\u002Fcvil.eecs.yorku.ca\u002Fprojects\u002Fpublic_html\u002FsRGB_WB_correction\u002Fdataset.html). As an example, please refer to `dataset` directory.\n\n\n## Code\nWe provide source code for Matlab and PyTorch platforms. *There is no guarantee that the trained models produce exactly the same results.*\n\n\n### 1. Matlab (recommended)\n\n#### Prerequisite\n1. Matlab 2019b or higher \n2. Deep Learning Toolbox\n\n#### Get Started\nRun `install_.m`\n\n##### Demos:\n\n1. Run `demo_single_image.m` or `demo_images.m` to process a single image or image directory, respectively. The available tasks are AWB, all, and editing. If you run the demo_single_image.m, it should save the result in `..\u002Fresult_images` and output the following figure:\n\n\u003Cp align=\"center\">\n  \u003Cimg width = 60% src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_841a42d3045a.png\">\n\u003C\u002Fp>\n\n\n2. Run `demo_GUI.m` for a gui demo.\n\u003Cp align=\"center\">\n  \u003Cimg width = 50% src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_f4f4ff27787f.gif\">\n\u003C\u002Fp>\n\n\n##### Training Code:\nRun `training.m` to start training. You should adjust training image directories from the `datasetDir` variable before running the code. You can change the training settings in `training.m` before training.  \n\nFor example, you can use `epochs` and `miniBatch` variables to change the number of training epochs and mini-batch size, respectively. If you set `fold = 0` and `trainingImgsNum = 0`, the training will use all training data without fold cross-validation. If you would like to limit the number of training images to be `n` images, set `trainingImgsNum` to `n`. If you would like to do 3-fold cross-validation, use `fold = testing_fold`. Then the code will train on the remaining folds and leave the selected fold for testing. \n\nOther useful options include: `patchsPerImg` to select the number of random patches per image and `patchSize` to set the size of training patches. To control the learning rate drop rate and factor, please check the `get_training_options.m` function located in the `utilities` directory. You can use the `loadpath` variable to continue training from a training checkpoint `.mat` file. To start training from scratch, use `loadpath=[];`.\n\nOnce training started, a `.cvs` file will be created in the `reports_and_checkpoints` directory. You can use this file to visualize training progress. If you run Matlab with a graphical interface and you want to visualize some of input\u002Foutput patches during training, set a breakpoint [here](.\u002FMatlab\u002Farch\u002FmaeLossLayer.m#L30) and write the following code in the command window:\n\n```close all; i = 1; figure; subplot(2,3,1);imshow(extractdata(Y(:,:,1:3,i)));  subplot(2,3,2);imshow(extractdata(Y(:,:,4:6,i)));  subplot(2,3,3);imshow(extractdata(Y(:,:,7:9,i))); subplot(2,3,4); imshow(gather(T(:,:,1:3,i))); subplot(2,3,5); imshow(gather(T(:,:,4:6,i))); subplot(2,3,6); imshow(gather(T(:,:,7:9,i)));``` \n\nYou can change the value of `i` in the above code to see different images in the current training batch. The figure will show you produced patches (first row) and the corresponding ground truth patches (second row). For non-graphical interface, you can edit your custom code [here](.\u002FMatlab\u002Farch\u002FmaeLossLayer.m#L30) to save example patches periodically. Hint: you may need to use a [persistent variable](https:\u002F\u002Fwww.mathworks.com\u002Fhelp\u002Fmatlab\u002Fref\u002Fpersistent.html) to control the process. Alternative solutions include using [custom trianing loop](https:\u002F\u002Fwww.mathworks.com\u002Fhelp\u002Fdeeplearning\u002Fug\u002Fdefine-custom-training-loops-loss-functions-and-networks.html). \n\n\n### 2. PyTorch\n\n#### Prerequisite\n\n1. Python 3.6\n\n2. pytorch (tested with 1.2.0 and 1.5.0)\n\n3. torchvision (tested with 0.4.0 and 0.6.0)\n\n4. cudatoolkit\n\n5. tensorboard (optional)\n\n6. numpy \n\n7. Pillow\n\n8. future\n\n9. tqdm\n\n10. matplotlib\n\n11. scipy\n\n12. scikit-learn\n\n\n##### The code may work with library versions other than the specified.\n\n#### Get Started\n\n##### Demos:\n1. Run `demo_single_image.py` to process a single image.\nExample of applying AWB + different WB settings: `python demo_single_image.py --input_image ..\u002Fexample_images\u002F00.jpg --output_image ..\u002Fresult_images --show`. This example should save the output image in `..\u002Fresult_images` and output the following figure:\n\u003Cp align=\"center\">\n  \u003Cimg width = 55% src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_c7bac7083bb3.png\">\n\u003C\u002Fp>\n\n\n2. Run `demo_images.py` to process image directory. Example: `python demo_images.py --input_dir ..\u002Fexample_images\u002F --output_dir ..\u002Fresult_images --task AWB`. The available tasks are AWB, all, and editing. You can also specify the task in the `demo_single_image.py` demo.\n\n##### Training Code:\nRun `training.py` to start training. You should adjust training image directories before running the code. \n\nExample: `CUDA_VISIBLE_DEVICE=0 python train.py --training_dir ..\u002Fdataset\u002F --fold 0 --epochs 500 --learning-rate-drop-period 50 --num_training_images 0`. In this example, `fold = 0` and `num_training_images = 0` mean that the training will use all training data without fold cross-validation. If you would like to limit the number of training images to be `n` images, set `num_training_images` to `n`. If you would like to do 3-fold cross-validation, use `fold = testing_fold`. Then the code will train on the remaining folds and leave the selected fold for testing.\n\nOther useful options include: `--patches-per-image` to select the number of random patches per image, `--learning-rate-drop-period` and `--learning-rate-drop-factor` to control the learning rate drop period and factor, respectively, and `--patch-size` to set the size of training patches. You can continue training from a training checkpoint `.pth` file using `--load` option. \n\nIf you have TensorBoard installed on your machine, run `tensorboard --logdir .\u002Fruns` after start training to check training progress and visualize samples of input\u002Foutput patches. \n\n### Results\n\n\n![results](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_d2aa47c1de0a.jpg)\n\n\u003Cp align=\"center\">\n  \u003Cimg width = 90% src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_34b71d6fb376.jpg\">\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg width = 65% src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_b5710c97855b.jpg\">\n\u003C\u002Fp>\n\n\nThis software is provided for research purposes only and CAN NOT be used for commercial purposes.\n\n\nMaintainer: Mahmoud Afifi (m.3afifi@gmail.com)\n\n\n## Related Research Projects\n- [When Color Constancy Goes Wrong](https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FWB_sRGB): The first work to directly address the problem of incorrectly white-balanced images; requires a small memory overhead and it is fast (CVPR 2019).\n- [White-Balance Augmenter](https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FWB_color_augmenter): An augmentation technique based on camera WB errors (ICCV 2019).\n- [Interactive White Balancing](https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FInteractive_WB_correction):A simple method to link the nonlinear white-balance correction to the user's selected colors to allow interactive white-balance manipulation (CIC 2020).\n- [Exposure Correction](https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FExposure_Correction): A single coarse-to-fine deep learning model with adversarial training to correct both over- and under-exposed photographs (CVPR 2021).\n","# 深度白平衡编辑，CVPR 2020（口头报告）\n\n*[Mahmoud Afifi](https:\u002F\u002Fsites.google.com\u002Fview\u002Fmafifi)*\u003Csup>1,2\u003C\u002Fsup> 和 *[Michael S. Brown](http:\u002F\u002Fwww.cse.yorku.ca\u002F~mbrown\u002F)*\u003Csup>1\u003C\u002Fsup>\n\n\u003Csup>1\u003C\u002Fsup>三星AI中心（SAIC）- 多伦多\n\n\u003Csup>2\u003C\u002Fsup>约克大学  \n\n\n\n[口头报告视频](https:\u002F\u002Fyoutu.be\u002Fb2u705wZOvU) \n\n\n\n![deep_WB_fig](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_1efaa43232a7.jpg)\n\n论文参考代码：[Deep White-Balance Editing](http:\u002F\u002Fopenaccess.thecvf.com\u002Fcontent_CVPR_2020\u002Fpapers\u002FAfifi_Deep_White-Balance_Editing_CVPR_2020_paper.pdf)。Mahmoud Afifi 和 Michael S. Brown，CVPR 2020。如果您使用此代码或我们的数据集，请引用我们的论文：\n```\n@inproceedings{afifi2020deepWB,\n  title={Deep White-Balance Editing},\n  author={Afifi, Mahmoud and Brown, Michael S},\n  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},\n  year={2020}\n}\n```\n\n![network](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_3abaf7894a52.jpg)\n\n## 训练数据\n\n1. 下载 [Rendered WB 数据集](http:\u002F\u002Fcvil.eecs.yorku.ca\u002Fprojects\u002Fpublic_html\u002FsRGB_WB_correction\u002Fdataset.html)。\n\n2. 将输入图像和真实标签图像分别复制到同一个目录中。每对输入\u002F标签图像应采用以下命名格式：输入图像为 `name_WB_picStyle.png`，对应的标签图像为 `name_G_AS.png`。这与 [Rendered WB 数据集](http:\u002F\u002Fcvil.eecs.yorku.ca\u002Fprojects\u002Fpublic_html\u002FsRGB_WB_correction\u002Fdataset.html) 中使用的文件名风格一致。请参阅 `dataset` 目录以获取示例。\n\n\n## 代码\n我们提供了 Matlab 和 PyTorch 平台的源代码。*无法保证训练好的模型会生成完全相同的结果。*\n\n\n### 1. Matlab（推荐）\n\n#### 前提条件\n1. Matlab 2019b 或更高版本\n2. 深度学习工具箱\n\n#### 使用说明\n运行 `install_.m`\n\n##### 示例：\n\n1. 运行 `demo_single_image.m` 或 `demo_images.m` 分别处理单张图像或图像目录。可用任务包括 AWB、全部和编辑。如果运行 `demo_single_image.m`，结果将保存在 `..\u002Fresult_images` 中，并输出如下图像：\n\n\u003Cp align=\"center\">\n  \u003Cimg width = 60% src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_841a42d3045a.png\">\n\u003C\u002Fp>\n\n\n2. 运行 `demo_GUI.m` 进行 GUI 演示。\n\u003Cp align=\"center\">\n  \u003Cimg width = 50% src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_f4f4ff27787f.gif\">\n\u003C\u002Fp>\n\n\n##### 训练代码：\n运行 `training.m` 开始训练。在运行代码之前，您需要调整 `datasetDir` 变量中的训练图像目录。您可以在训练前修改 `training.m` 中的训练设置。  \n\n例如，您可以使用 `epochs` 和 `miniBatch` 变量分别更改训练轮数和小批量大小。如果将 `fold = 0` 和 `trainingImgsNum = 0` 设置，则训练将使用所有训练数据，不进行交叉验证。如果您希望将训练图像数量限制为 `n` 张，请将 `trainingImgsNum` 设置为 `n`。若要进行 3 折交叉验证，可将 `fold` 设置为 `testing_fold`。此时代码将在剩余折数上进行训练，并将选定的一折用于测试。  \n\n其他有用选项包括：`patchsPerImg` 用于选择每张图像的随机补丁数量，以及 `patchSize` 用于设置训练补丁的大小。要控制学习率下降的速率和因子，请查看位于 `utilities` 目录中的 `get_training_options.m` 函数。您可以使用 `loadpath` 变量从 `.mat` 格式的训练检查点继续训练。若要从头开始训练，请将 `loadpath=[];`。\n\n训练开始后，会在 `reports_and_checkpoints` 目录下生成一个 `.csv` 文件，可用于可视化训练进度。如果您使用带有图形界面的 Matlab，并希望在训练过程中可视化部分输入\u002F输出补丁，请在 [此处](.\u002FMatlab\u002Farch\u002FmaeLossLayer.m#L30) 设置断点，并在命令窗口中输入以下代码：\n\n```close all; i = 1; figure; subplot(2,3,1);imshow(extractdata(Y(:,:,1:3,i)));  subplot(2,3,2);imshow(extractdata(Y(:,:,4:6,i)));  subplot(2,3,3);imshow(extractdata(Y(:,:,7:9,i))); subplot(2,3,4); imshow(gather(T(:,:,1:3,i))); subplot(2,3,5); imshow(gather(T(:,:,4:6,i))); subplot(2,3,6); imshow(gather(T(:,:,7:9,i)));``` \n\n您可以通过更改上述代码中的 `i` 值来查看当前批次中的不同图像。该图将显示生成的补丁（第一行）及其对应的标签补丁（第二行）。对于无图形界面的情况，您可以编辑自定义代码 [此处](.\u002FMatlab\u002Farch\u002FmaeLossLayer.m#L30) 来定期保存示例补丁。提示：您可能需要使用 [持久变量](https:\u002F\u002Fwww.mathworks.com\u002Fhelp\u002Fmatlab\u002Fref\u002Fpersistent.html) 来控制这一过程。另一种方法是使用 [自定义训练循环](https:\u002F\u002Fwww.mathworks.com\u002Fhelp\u002Fdeeplearning\u002Fug\u002Fdefine-custom-training-loops-loss-functions-and-networks.html)。\n\n### 2. PyTorch\n\n#### 前置条件\n\n1. Python 3.6\n\n2. PyTorch（已测试版本：1.2.0 和 1.5.0）\n\n3. torchvision（已测试版本：0.4.0 和 0.6.0）\n\n4. cudatoolkit\n\n5. tensorboard（可选）\n\n6. numpy\n\n7. Pillow\n\n8. future\n\n9. tqdm\n\n10. matplotlib\n\n11. scipy\n\n12. scikit-learn\n\n\n##### 代码可能在指定版本之外的库版本上也能运行。\n\n#### 开始使用\n\n##### 示例：\n1. 运行 `demo_single_image.py` 处理单张图片。\n   应用 AWB + 不同白平衡设置的示例：`python demo_single_image.py --input_image ..\u002Fexample_images\u002F00.jpg --output_image ..\u002Fresult_images --show`。此示例应在 `..\u002Fresult_images` 中保存输出图像，并显示如下图像：\n\u003Cp align=\"center\">\n  \u003Cimg width = 55% src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_c7bac7083bb3.png\">\n\u003C\u002Fp>\n\n\n2. 运行 `demo_images.py` 处理图片目录。示例：`python demo_images.py --input_dir ..\u002Fexample_images\u002F --output_dir ..\u002Fresult_images --task AWB`。可用任务包括 AWB、all 和 editing。您也可以在 `demo_single_image.py` 示例中指定任务。\n\n##### 训练代码：\n运行 `training.py` 开始训练。在运行代码之前，您应调整训练图像目录。\n\n示例：`CUDA_VISIBLE_DEVICE=0 python train.py --training_dir ..\u002Fdataset\u002F --fold 0 --epochs 500 --learning-rate-drop-period 50 --num_training_images 0`。在此示例中，`fold = 0` 和 `num_training_images = 0` 表示训练将使用所有训练数据，不进行交叉验证。如果您希望将训练图像数量限制为 `n` 张，请将 `num_training_images` 设置为 `n`。如果您希望进行 3 折交叉验证，请使用 `fold = testing_fold`。此时，代码将在剩余的折中进行训练，并将选定的折用于测试。\n\n其他有用的选项包括：`--patches-per-image` 用于选择每张图像的随机补丁数量；`--learning-rate-drop-period` 和 `--learning-rate-drop-factor` 分别用于控制学习率下降的周期和因子；以及 `--patch-size` 用于设置训练补丁的大小。您可以使用 `--load` 选项从 `.pth` 训练检查点文件继续训练。\n\n如果您机器上安装了 TensorBoard，在开始训练后运行 `tensorboard --logdir .\u002Fruns` 可以查看训练进度并可视化输入\u002F输出补丁的样本。\n\n### 结果\n\n\n![results](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_d2aa47c1de0a.jpg)\n\n\u003Cp align=\"center\">\n  \u003Cimg width = 90% src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_34b71d6fb376.jpg\">\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg width = 65% src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_readme_b5710c97855b.jpg\">\n\u003C\u002Fp>\n\n\n本软件仅用于研究目的，不得用于商业用途。\n\n\n维护者：Mahmoud Afifi（m.3afifi@gmail.com）\n\n\n## 相关研究项目\n- [当颜色恒常性出错时](https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FWB_sRGB)：首次直接解决白平衡错误问题的工作；内存开销小且速度快（CVPR 2019）。\n- [白平衡增强器](https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FWB_color_augmenter)：一种基于相机白平衡误差的增强技术（ICCV 2019）。\n- [交互式白平衡](https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FInteractive_WB_correction)：一种简单的方法，将非线性白平衡校正与用户选择的颜色关联起来，从而实现交互式的白平衡调整（CIC 2020）。\n- [曝光校正](https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FExposure_Correction)：一种采用对抗训练的单一粗到细深度学习模型，用于同时校正过度曝光和欠曝光的照片（CVPR 2021）。","# Deep_White_Balance 快速上手指南\n\nDeep White-Balance Editing 是 CVPR 2020 Oral 论文开源项目，用于对图像进行自动白平衡（AWB）校正及交互式白平衡编辑。本项目提供 Matlab 和 PyTorch 两个版本的代码，**推荐优先使用 Matlab 版本**以获得更稳定的复现效果。\n\n## 环境准备\n\n### 方案一：Matlab 版本（推荐）\n*   **操作系统**：Windows \u002F Linux \u002F macOS\n*   **软件要求**：Matlab 2019b 或更高版本\n*   **工具箱依赖**：Deep Learning Toolbox\n\n### 方案二：PyTorch 版本\n*   **操作系统**：Linux \u002F Windows (需配置 CUDA)\n*   **语言环境**：Python 3.6+\n*   **核心依赖**：\n    *   PyTorch (测试版本：1.2.0, 1.5.0)\n    *   torchvision (测试版本：0.4.0, 0.6.0)\n    *   cudatoolkit\n*   **其他库**：`numpy`, `Pillow`, `future`, `tqdm`, `matplotlib`, `scipy`, `scikit-learn`, `tensorboard` (可选)\n\n> **国内加速建议**：安装 Python 依赖时，建议使用清华或阿里镜像源加速下载：\n> `pip install -r requirements.txt -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple`\n\n## 安装步骤\n\n### 1. 获取代码与数据\n克隆仓库后，首先需要下载训练数据集（Rendered WB dataset）。\n*   **数据集下载地址**：[Rendered WB dataset](http:\u002F\u002Fcvil.eecs.yorku.ca\u002Fprojects\u002Fpublic_html\u002FsRGB_WB_correction\u002Fdataset.html)\n*   **数据整理**：将输入图像和真值图像放入同一目录。文件名需遵循特定格式：\n    *   输入图像：`name_WB_picStyle.png`\n    *   真值图像：`name_G_AS.png`\n    *   参考示例请查看项目中的 `dataset` 目录结构。\n\n### 2. 初始化环境\n\n**Matlab 用户：**\n在 Matlab 中运行以下脚本完成路径配置：\n```matlab\ninstall_.m\n```\n\n**PyTorch 用户：**\n确保已安装上述列出的 Python 依赖包。若未安装，可手动执行：\n```bash\npip install torch torchvision numpy Pillow future tqdm matplotlib scipy scikit-learn\n```\n\n## 基本使用\n\n以下示例展示如何对单张图片进行白平衡处理。\n\n### 场景一：使用 Matlab (推荐)\n\n运行演示脚本处理单张图片或整个文件夹。支持的任务模式包括：`AWB` (自动白平衡), `all`, `editing`。\n\n**处理单张图片：**\n```matlab\ndemo_single_image.m\n```\n*执行后结果将保存至 `..\u002Fresult_images` 目录，并弹出对比图。*\n\n**启动图形界面 (GUI) 进行交互式编辑：**\n```matlab\ndemo_GUI.m\n```\n\n### 场景二：使用 PyTorch\n\n**处理单张图片：**\n以下命令将对输入图片应用 AWB 及多种白平衡设置，并显示结果。\n```bash\npython demo_single_image.py --input_image ..\u002Fexample_images\u002F00.jpg --output_image ..\u002Fresult_images --show\n```\n\n**处理整个图片目录：**\n```bash\npython demo_images.py --input_dir ..\u002Fexample_images\u002F --output_dir ..\u002Fresult_images --task AWB\n```\n*注：`--task` 参数可选值为 `AWB`, `all`, `editing`。*\n\n---\n*声明：本软件仅供学术研究使用，不可用于商业用途。*","一位电商摄影师正在处理一批在混合光源（如橱窗自然光与室内暖黄射灯）下拍摄的服装产品图，急需统一色调以符合品牌视觉规范。\n\n### 没有 Deep_White_Balance 时\n- **手动调色效率极低**：面对数百张不同色温的照片，设计师只能在 Photoshop 中逐张拖动色温滑块，耗时数小时且难以保持一致性。\n- **色彩还原失真**：传统自动白平衡算法在复杂混合光线下容易误判，导致白色衬衫偏蓝或肤色呈现病态的蜡黄，严重影响商品质感。\n- **缺乏精细编辑能力**：现有工具通常只能“校正”色偏，无法像后期修图师那样根据创意需求灵活调整画面冷暖氛围，限制了创作空间。\n- **批次处理效果参差**：使用简单的批量滤镜会导致部分过曝或欠曝区域色彩断裂，不得不重新返工进行局部蒙版修复。\n\n### 使用 Deep_White_Balance 后\n- **智能多任务一键处理**：利用其深度学习框架，Deep_White_Balance 能自动识别场景光照并批量完成自动白平衡校正，将数小时的工作缩短至几分钟。\n- **精准的色彩复原**：基于 CVPR 2020 获奖算法，该工具在混合光源下仍能准确还原衣物本色，消除不自然的色偏，确保肤色和织物纹理真实自然。\n- **灵活的创意编辑模式**：除了自动校正，Deep_White_Balance 还提供“编辑”模式，允许用户在保持色彩连贯性的前提下，自由调节画面冷暖风格以满足营销需求。\n- **高质量的输出稳定性**：得益于多任务学习架构，即使在光影复杂的边缘区域，生成的图像也能保持平滑过渡，避免了传统方法常见的色彩断层和噪点。\n\nDeep_White_Balance 通过 AI 驱动的精准色温控制，将繁琐且依赖经验的色彩校正工作转化为高效、标准化的自动化流程，显著提升了视觉内容的生产质量与速度。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmahmoudnafifi_Deep_White_Balance_1efaa432.jpg","mahmoudnafifi","Mahmoud Afifi","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fmahmoudnafifi_d4ecd008.jpg","Ex-Research Scientist, Ex-Camera Engineer",null,"Earth ","www.mafifi.info","https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi",[23,27],{"name":24,"color":25,"percentage":26},"Python","#3572A5",54.4,{"name":28,"color":29,"percentage":30},"MATLAB","#e16737",45.6,613,73,"2026-04-10T05:40:05","NOASSERTION",3,"未说明","PyTorch 版本需要 cudatoolkit（具体版本未说明，需匹配 PyTorch 1.2.0\u002F1.5.0）；Matlab 版本未明确要求 GPU",{"notes":39,"python":40,"dependencies":41},"该工具提供 Matlab (推荐，需 2019b+ 及 Deep Learning Toolbox) 和 PyTorch 两种实现。PyTorch 版本依赖较旧（测试于 1.2.0\u002F1.5.0），建议创建独立虚拟环境以避免冲突。训练数据需单独下载 Rendered WB 数据集并按特定格式命名。代码仅供研究使用，不可商用。","3.6",[42,43,44,45,46,47,48,49,50,51],"pytorch (1.2.0 或 1.5.0)","torchvision (0.4.0 或 0.6.0)","cudatoolkit","numpy","Pillow","future","tqdm","matplotlib","scipy","scikit-learn",[53],"图像",[55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73],"multitask-learning","white-balance","color-correction","color-constancy","auto-white-balance","image-manipulation","color-manipulation","image-enhancement","color-enhancement","color-processing","deeplearning","autoencoder","auto-encoder","cvpr2020","cvpr-2020","cvpr20","computational-photography","deep-white-balance","whitebalance",2,"ready","2026-03-27T02:49:30.150509","2026-04-11T17:40:52.411088",[79,84,89,94,99,104,109],{"id":80,"question_zh":81,"answer_zh":82,"source_url":83},29725,"如何设置数据集目录以及训练数据的文件格式要求是什么？","除非需要重新训练模型，否则无需下载任何数据集即可运行程序。若需训练（如使用 Set1），请将输入图像和真值图像复制到同一个目录中。文件命名格式必须为：输入图像 'name_WB_picStyle.png'，对应的真值图像 'name_G_AS.png'（与 Rendered WB 数据集风格一致）。\n具体配置方法：\n1. Matlab：在运行代码前，修改 'training.m' 文件中的 'datasetDir' 变量来调整训练图像目录。\n2. PyTorch：使用 '--training_dir' 参数设置目录。\n示例命令：CUDA_VISIBLE_DEVICE=0 python train.py --training_dir ..\u002Fdataset\u002F","https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FDeep_White_Balance\u002Fissues\u002F1",{"id":85,"question_zh":86,"answer_zh":87,"source_url":88},29726,"如何在 Set2 或 Cube+ 数据集上训练模型？这些数据集缺少对应的真值图像怎么办？","默认的数据加载器主要适用于 Set1。若要在 Cube+ 等数据集上训练，你有两个选择：\n1. 将 Cube+ 的真值图像重命名，使其以 'G_AS.png' 结尾；\n2. 修改代码以适配现有文件名。\n注意：Set1 中并非所有图像都有带有 Adobe Standard (AS) 图片风格的 T 和 S 白平衡设置真值，因此需要添加代码筛选出具有真值的图像。维护者已上传整理好的 Set1 压缩包，建议优先查看 README 或项目主页获取处理好的数据集。","https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FDeep_White_Balance\u002Fissues\u002F3",{"id":90,"question_zh":91,"answer_zh":92,"source_url":93},29727,"为什么评估结果与论文中的数据不一致？应该使用什么评估代码？","如果你使用的是 PyTorch 版本，训练出的模型无法保证产生与论文完全一致的结果。若要复现论文报告的确切结果，请使用 Matlab 代码。\n评估算法应参考 WB_sRGB 仓库中的代码（该代码同样用于本文评估）：\nhttps:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FWB_sRGB\u002Ftree\u002Fmaster\u002FWB_sRGB_Python\n请确保使用正确的评估脚本进行指标计算（如 DeltaE, MSE, MAE）。","https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FDeep_White_Balance\u002Fissues\u002F9",{"id":95,"question_zh":96,"answer_zh":97,"source_url":98},29728,"如何计算图像的 MAE（平均角误差）？输入是图像而非向量时如何处理？","MAE 是指像素级角误差的平均值。虽然公式涉及向量夹角（arccos(V1, V2)），但针对图像输出和真值，需要逐像素计算。\n具体的评估代码实现请参考以下链接：\n1. Python 评估代码：https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FWB_sRGB\u002Ftree\u002Fmaster\u002FWB_sRGB_Python\u002Fevaluation\n2. Matlab 评估代码：https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FWB_sRGB\u002Ftree\u002Fmaster\u002FWB_sRGB_Matlab\u002Fevaluation\n直接复用这些官方提供的评估脚本即可正确计算图像的 MAE。","https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FDeep_White_Balance\u002Fissues\u002F13",{"id":100,"question_zh":101,"answer_zh":102,"source_url":103},29729,"代码中的 get_mapping_func 有什么作用？为什么要先获取映射再计算输出，而不是直接计算？","这样做主要有几个原因，其中包括处理高分辨率图像时的性能问题。通过先从缩小尺寸的图像（image_resized）获取到输出白平衡（output_awb）的映射关系，再将该映射应用到原图，可以显著提高效率和性能。详细的原理讨论请参阅论文的第 2.5 节（Sec 2.5）。","https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FDeep_White_Balance\u002Fissues\u002F12",{"id":105,"question_zh":106,"answer_zh":107,"source_url":108},29730,"关于白平衡操纵实验（论文表 2）的结果，如果数据集中缺少某些色温（如 6500K Cloudy）的真值图像该如何处理？","如果在特定数据集（如 cube++）中缺少某种色温（例如 6500K Cloudy）的真值图像，可以直接忽略该条件下的结果。在复现实验时，若无法生成对应的真值，剔除该部分数据是可以接受的解决方案。","https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FDeep_White_Balance\u002Fissues\u002F10",{"id":110,"question_zh":111,"answer_zh":112,"source_url":113},29731,"是否支持直接处理视频文件？","目前代码暂不支持直接处理视频文件。维护者表示目前没有时间安排开发此功能。建议用户手动提取视频帧进行处理，然后再合并序列。欢迎社区贡献者提交相关代码以实现视频支持。","https:\u002F\u002Fgithub.com\u002Fmahmoudnafifi\u002FDeep_White_Balance\u002Fissues\u002F6",[],[116,127,135,143,152,161],{"id":117,"name":118,"github_repo":119,"description_zh":120,"stars":121,"difficulty_score":35,"last_commit_at":122,"category_tags":123,"status":75},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,"2026-04-06T06:32:30",[124,125,53,126],"Agent","开发框架","数据工具",{"id":128,"name":129,"github_repo":130,"description_zh":131,"stars":132,"difficulty_score":35,"last_commit_at":133,"category_tags":134,"status":75},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",[125,53,124],{"id":136,"name":137,"github_repo":138,"description_zh":139,"stars":140,"difficulty_score":74,"last_commit_at":141,"category_tags":142,"status":75},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[125,53,124],{"id":144,"name":145,"github_repo":146,"description_zh":147,"stars":148,"difficulty_score":74,"last_commit_at":149,"category_tags":150,"status":75},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[151,124,53,125],"插件",{"id":153,"name":154,"github_repo":155,"description_zh":156,"stars":157,"difficulty_score":35,"last_commit_at":158,"category_tags":159,"status":75},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",[160,53,124,125],"语言模型",{"id":162,"name":163,"github_repo":164,"description_zh":165,"stars":166,"difficulty_score":35,"last_commit_at":167,"category_tags":168,"status":75},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",[125,53,124,169],"视频"]