Shuwei Yue and *Minchen Wei
Color, Imaging, and Metaverse Research Center, The Hong Kong Polytechnic University.
If you use this code, please cite our paper:
@article{yue2023color,
title={Color constancy from a pure color view},
author={Yue, Shuwei and Wei, Minchen},
journal={JOSA A},
volume={40},
number={3},
pages={602--610},
year={2023},
publisher={Optica Publishing Group}
}
- Pytorch
- opencv-python
- step 1: Preparing the dataset
To train PCC, training/validation data should have the following formatting:
datasets/numpy_data/
|1_8D5U5524.npy
|2_8D5U5525.npy
...
datasets/numpy_labels/
|1_8D5U5524.npy
|2_8D5U5525.npy
...
Update on Sep. 29, 2024, There are some differences between the two formats:
- The Thumbnail version has
rawdata inpngformat, and thelabelis injsonformat, which includes extracted information from a 24-color card. - The Full-resolution version has both
rawandlabelinnpyformat, where thelabelcontains only RGB information of the light source.
It is recommended to directly use the full-resolution version for training.
So, it is better to preprocess your data and corresponding labels into .npy format.
The processed Recommend-ColorChecker dataset (CC2018) is provided in the folder of datasets/CC2018/. Noted that the black level and masked card of this dataset have been subtracted, then resized to
- step 2:
Run train.py
You can change the training fold number in
config/param_config.py
move your trained model from log folder to the pretrain_models
Run test.py
Thumbnails(.png) and full-resolution images(.npy) are provided in the following link:
