Paper]
Intrinsic Image Harmonization [Zonghui Guo, Haiyong Zheng, Yufeng Jiang, Zhaorui Gu, Bing Zheng
Here we provide PyTorch implementation and the trained model of our framework.
Prerequisites
- Linux
- Python 3
- CPU or NVIDIA GPU + CUDA CuDNN
Train/Test
-
Download iHarmony4 dataset, and our HVIDIT dataset Google Drive or BaiduCloud (access code: akbi).
-
Train a model:
CUDA_VISIBLE_DEVICES=0 python train.py --model retinexltifpm --name retinexltifpm_allihd --dataset_root <dataset_dir> --dataset_name IHD --batch_size xx --init_port xxxx
- Test the model
CUDA_VISIBLE_DEVICES=0 python test.py --model retinexltifpm --name retinexltifpm_allihd --dataset_root <dataset_dir> --dataset_name IHD --batch_size xx --init_port xxxx
Apply a pre-trained model
- Download the pretrained model from Google Drive or BaiduCloud (access code: 20m6), and put net_G.pth in the directory checkpoints/experiment. Run:
CUDA_VISIBLE_DEVICES=0 python test.py --model retinexltifpm --name experiment --dataset_root <dataset_dir> --dataset_name IHD --batch_size xx --init_port xxxx
Evaluation
We provide the code in ih_evaluation.py. Run:
CUDA_VISIBLE_DEVICES=0 python evaluation/ih_evaluation.py --dataroot <dataset_dir> --result_root results/experiment/test_latest/images/ --evaluation_type our --dataset_name ALL
Quantitative Result
Dataset | Metrics | Composite | Ours (iHarmony4) |
Ours (iHarmony4+HVIDIT) |
---|---|---|---|---|
HCOCO | PSNR MSE fMSE |
33.99 69.37 996.59 |
37.61 23.25 386.39 |
37.77 21.84 367.38 |
HAdobe5k | PSNR MSE fMSE |
28.52 345.54 2051.61 |
36.20 42.21 296.76 |
36.49 39.53 266.49 |
HFlickr | PSNR MSE fMSE |
28.43 264.35 1574.37 |
31.74 100.86 676.71 |
32.08 96.87 635.60 |
Hday2night | PSNR MSE fMSE |
34.36 109.65 1409.98 |
36.48 50.64 755.88 |
36.60 50.37 763.33 |
HVIDIT | PSNR MSE fMSE |
38.72 53.12 1604.41 |
- - - |
41.83 22.49 691.06 |
ALL | PSNR MSE fMSE |
32.07 167.39 1386.12 |
36.53 37.95 399.34 |
36.96 35.33 388.50 |
Bibtex
If you use this code for your research, please cite our papers.
@InProceedings{Guo_2021_CVPR,
author = {Guo, Zonghui and Zheng, Haiyong and Jiang, Yufeng and Gu, Zhaorui and Zheng, Bing},
title = {Intrinsic Image Harmonization},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2021},
pages = {16367-16376}
}
Acknowledgement
For some of the data modules and model functions used in this source code, we need to acknowledge the repo of DoveNet and CycleGAN.