This repo contains the official implementation of the IJCAI 2022 paper 'Domain Adversarial Learning for Color Constancy', the code will be available after the IJCAI 2022 meeting.
Please use the command pip install -r requirements.txt
or manually install the following packages.
- torch==1.9.0+cu111
- numpy==1.20.1
- matplotlib==3.3.4
- opencv_python==4.5.3.56
- torchsummary==1.5.1
- scipy==1.6.2
- torchvision==0.10.0+cu111
For details on RAW image preprocessing principle, please refer to RAW_preprocessing_MATLAB and RAW_preprocessing_Python.
- Download the dataset on: https://www2.cs.sfu.ca/~colour/data/shi_gehler/
- Store the download file in:
/dataset/colorconstancy/colorchecker2010/
- Set the path of the output file, such as:
/home/*/data/CC_full_size/
or/home/*/data/CC_resize/
- Run the
./dataset/color_constancy_data_process_all.py
code
- Download the dataset on: https://ipg.fer.hr/ipg/resources/color_constancy
- Store the download file in:
/dataset/colorconstancy/Cube/
- Set the path of the output file, such as:
/home/*/data/Cube_full_size/
or/home/*/data/Cube_resize/
- Run the
./dataset/color_constancy_data_process_all.py
code
- Download the dataset on: https://cvil.eecs.yorku.ca/projects/public_html/illuminant/illuminant.html
- Store the download file in:
/dataset/colorconstancy/NUS/
- Set the path of the output file, such as:
/home/*/data/NUS_full_size/
or/home/*/data/NUS_resize/
- Run the
./dataset/color_constancy_data_process_all.py
code
- If you have done the above, run the
./dataset/data_read.py
for a simple test. - Run
./dataset/data_loder.py
to check that the data loader is running correctly. - Refer to the
./dataset/fold_dalcc.py
to check the three cross-validation. The fold for cross-validation can be found in./data_fold/
- Download the Alexnet model parameter that pre-trained on ImageNet, and run the
./model/alexnet.py
to check the AlexNet model. - Run the
./model/DALCC.py
to check the DALCC model.
- Run the
./train.py
to train the DALCC model. - Run the
./test.py
to test the DALCC model.
- You can find the pretrained model on Cube+ and NUS-8 on Pretrained Model.