Git Product home page Git Product logo

cie_xyz_net's Introduction

CIE XYZ Net: Unprocessing Images for Low-Level Computer Vision Tasks

Mahmoud Afifi, Abdelrahman Abdelhamed, Abdullah Abuolaim, Abhijith Punnappurath, and Michael S. Brown

York University

Reference code for the paper CIE XYZ Net: Unprocessing Images for Low-Level Computer Vision Tasks. Mahmoud Afifi, Abdelrahman Abdelhamed, Abdullah Abuolaim, Abhijith Punnappurath, and Michael S. Brown, IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 2021. If you use this code or our dataset, please cite our paper:

@article{CIEXYZNet,
  title={CIE XYZ Net: Unprocessing Images for Low-Level Computer Vision Tasks},
  author={Afifi, Mahmoud and Abdelhamed, Abdelrahman and Abuolaim, Abdullah and Punnappurath, Abhijith and Brown, Michael S},
  journal={IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI)},
  pages={},
  year={2021}
}

Code (MIT License)

network_design

Prerequisite

  1. Python 3.6
  2. opencv-python
  3. pytorch (tested with 1.5.0)
  4. torchvision (tested with 0.6.0)
  5. cudatoolkit
  6. tensorboard (optional)
  7. numpy
  8. future
  9. tqdm
  10. matplotlib
The code may work with library versions other than the specified.

Get Started

Demos:

  1. Run demo_single_image.py or demo_images.py to convert from sRGB to XYZ and back. You can change the task to run only one of the inverse or forward networks.
  2. Run demo_single_image_with_operators.py or demo_images_with_operators.py to apply an operator(s) to the intermediate layers/images. The operator code should be located in the pp_code directory. You should change the code in pp_code/postprocessing.py with your operator code.

Training Code:

Run train.py to re-train our network. You will need to adjust the training/validation directories accordingly.

Note:

All experiments in the paper were reported using the Matlab version of CIE XYZ Net. The PyTorch code/model is provided to facilitate using our framework with PyTorch, but there is no guarantee that the Torch version gives exactly the same reconstruction/rendering results reported in the paper.



Prerequisite

  1. Matlab 2019b or higher
  2. Deep Learning Toolbox

Get Started

Run install_.m.

Demos:

  1. Run demo_single_image.m or demo_images.m to convert from sRGB to XYZ and back. You can change the task to run only one of the inverse or forward networks.
  2. Run demo_single_image_with_operators.m or demo_images_with_operators.m to apply an operator(s) to the intermediate layers/images. The operator code should be located in the pp_code directory. You should change the code in pp_code/postprocessing.m with your operator code.

Training Code:

Run training.m to re-train our network. You will need to adjust the training/validation directories accordingly.

sRGB2XYZ Dataset

srgb2xyz

Our sRGB2XYZ dataset contains ~1,200 pairs of camera-rendered sRGB and the corresponding scene-referred CIE XYZ images (971 training, 50 validation, and 244 testing images).

Training set (11.1 GB): Part 0 | Part 1 | Part 2 | Part 3 | Part 4 | Part 5

Validation set (570 MB): Part 0

Testing set (2.83 GB): Part 0 | Part 1

Dataset License:

As the dataset was originally rendered using raw images taken from the MIT-Adobe FiveK dataset, our sRGB2XYZ dataset follows the original license of the MIT-Adobe FiveK dataset.

cie_xyz_net's People

Contributors

mahmoudnafifi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cie_xyz_net's Issues

Does the XYZ color space apply to some image retouching operations, such as Hue or Saturation adjustments?

Hi, thank you for your great work. I have been studying image retouching recently, which usually involves using rawRGB images. I am wondering if the XYZ color space is also suitable for some image retouching operations. For example, when I want to modify the Hue of an image, I would convert the image to the HSV color space and then adjust the H channel. However, I am not sure if the general RGB-to-HSV conversion formula is applicable in the XYZ color space.

PSNR calculation

Hi @mahmoudnafifi. Thanks for your great work.
I have some question about XYZ colorspace & PSNR calculation.

First, I searched for the range of the XYZ color space because the PSNR calculation requires the maximum value of the signal.
As you can see in Professor Michael S. Brown's slide, there is a range of XYZ values:
image
As far as I know, these three functions represent the XYZ mixing coefficients (XYZ values) for representing the color of light corresponding to a particular single wavelength.

In one article, the author says that the values of XYZ are [X-95.047, Y-100, Z-108.883].
I believe Michael's slide is correct, but is there another version of CIE XYZ that I'm not aware of?

Second, if so, how can I calculate the PSNR of a CIE XYZ image?
The channel ranges in CIE XYZ are all different. How did you calculate the PSNR calculated in table 1 of the CIE XYZnet paper?

Question about sRGB-XYZ pair generation

Hi, @mahmoudnafifi.
I have a question about sRGB-XYZ image pair generation.
I am currently generating my own stylized sRGB - XYZ image dataset, using NUS-8 dataset.
The stylized sRGB images are generated using Adobe lightroom classic, using RAW files.
And I generated XYZ images with DCRAW.
[using "dcraw -r {1/wb_kernel[0]} 1.0 {1/wb_kernel[2]} 1.0 -o 5 -g 1 1 -6 -T {raw_file}"]

However, I noticed that the XYZ and stylized sRGB images have different sizes.
I think the lens correction matrix might be the reason, but I'm not sure why.
I'd like the software to generate both images to be the same, but I'm stuck between lightroom for generating stylized sRGB and DCRAW or rawpy for generating XYZ images.
Can you think of anything that might be causing the size of the two images to mismatch?

stylized_sRGB

The size of stylized sRGB is 5616x3744.

XYZ

The size of XYZ is 5640x3752.

Question about XYZ to sRGB conversion details

Hi Mahmoud,

Thank your valuable work. I have downloaded the image pairs you provided and I want to further modify some parameters such as brightness, contrast, saturation, etc. to augment the number of traing image pairs.
I was wondering if you could provide more details on the XYZ to sRGB conversion process. Specifically, I'm interested in knowing which parameters in the Adobe Camera RAW software development kit you adjusted and how these parameters were adjusted.
Thank you very much for your time and attention.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.