This is our Keras implementation for reconstructing test images of known datasets using our trained models.
- Python 2 or 3
- Keras (with any Theano or Tensorflow backend)
- Install Keras along with your preferred backend. For Ubuntu, you can easily install by:
pip install tensorflow keras
- Clone this repository and enter:
git clone https://github.com/bernardohenz/deep_joint_design_cfa_demosaicing.git
cd deep_joint_design_cfa_demosaicing
- Download trained models
python ./trained_models/download_trained_models.py
- Install h5py in order to load the models:
pip install h5py
- Download test datasets
python ./datasets/download_datasets.py
- Run the test script
python test.py
- You can specify desired parameters like the following example
python test.py --datasets kodak --model our_4x4_noise --noise_std 4 --output_dir results_noise_std4
Parameter --datasets
specifies the test dataset you want to evaluate ([all | kodak | mcm | hdrvdp | moire]
)
Parameter --model
specifies the trained model to be loaded ([our_4x4_noise-free | our_4x4_noise | bayer ]
)
Parameter --noise_std
specifies the noise std to be added to the original image (in the scale [0,255]
)
Parameter --output_dir
specifies the folder where the reconstructions will be saved (the script will not save the reconstructions if this is not specified)
- Running the specified model on a particular image
python reconstruct_image.py --img_name datasets/kodak/kodim01.png --model our_4x4_noise-free --output_name out.png
- Running the specified model on directory
python reconstruct_images_from_dir.py --dir datasets/kodak --model our_4x4_noise-free --output_dir results_kodak
The original code was in Keras v1. We have updated to work on Keras>2.0, please follow to this training repository for the training script.
If you use this code, please cite our paper
@article{HenzGastalOliveira_2018,
author = {Bernardo Henz and Eduardo S. L. Gastal and Manuel M. Oliveira},
title = {Deep Joint Design of Color Filter Arrays and Demosaicing},
journal = {Computer Graphics Forum},
volume = {37},
year = {2018},
}