Code Monkey home page Code Monkey logo

midintrinsics's Introduction

MIDIntrinsics

Repo for the intrinsic component extension of MIT Multi-Illumination Dataset proposed in the paper "Intrinsic Image Decomposition via Ordinal Shading", Chris Careaga and Yağız Aksoy, ACM Transactions on Graphics, 2023

examples

Downloading the data

To compute intrinsic components for each image in MID, you must first download the original dataset. We provide the linear albedo images created from the HDR images in the dataset after white-balancing and tonemapping. You can use wget to download the zip archives:

wget https://data.csail.mit.edu/multilum/multi_illumination_test_mip2_exr.zip
wget https://data.csail.mit.edu/multilum/multi_illumination_train_mip2_exr.zip

We provide a single albedo image for each scene, these can be downloaded here. Once downloaded the zip archive can be placed next to the extracted MID data and the albedo images can be extracted directly into the MID directory:structure:

unzip midi_test_albedo -d multi_illumination_test_mip2_exr/

Since the albedo is computed from the tonemapped images, the shading images should be computed using the tonemapped images as well. We use the simple tonemapping function used by rendered datasets. The shading can be computed as:

tm_scale = get_tonemap_scale(img)
tm_img = (tm_scale * img).clip(0, 1)
shading = tm_img / albedo

This will generate a three-channel shading image. For training intrinsic decomposition methods that use the grayscale shading assumption, the shading images can be desaturated using a function like this. There are then two options for dealing with the desaturation. You can either push the color into the albedo image, ensuring that the input image is maintained and reconstructed, at the cost of each image potentially having slightly different albedo ground-truth:

new_albedo = tm_img / grey_shading

Or you can re-synthesize the input image from the original albedo and the grayscale shading:

new_img = albedo * grey_shading

This will essentially white-balance the input image and remove/alter any non-grayscale lighting effects captured by the three-channel shading (e.g. shadows, specularity, etc.). It will however ensure that each image shares a single albedo component.

Although it's not recommended, the albedo components can be used with the JPEG images in the Multi-Illumination Dataset. Since the albedo is linear, you must undo the gamma correction on the JPEG images before dividing by the albedo:

shading = (img ** 2.2) / albedo

Again, this is not recommended as the JPEG images may have artifacts and lost information that can be amplified when performing operations like division resulting in an inaccurate shading layer.

Generating the data

Alternatively, you can use our pipeline to re-generate the albedo estimations in case you want more flexibility. To do this you can download the original dataset in the same way. Then you can install our intrinsic decomposition pipeline:

pip install https://github.com/compphoto/Intrinsic/archive/master.zip

To generate the albedo estimations, you can run the generate_albedo script and point it to the downloaded multi-illumination data:

$ python generate_albedo.py --help

usage: generate_albedo.py [-h] [--mid_path MID_PATH] [--weights_path WEIGHTS_PATH] [--save_imgs] [--png]

optional arguments:
  -h, --help            show this help message and exit
  --mid_path MID_PATH   path to the Multi-Illumination Dataset (train or test)
  --weights_path WEIGHTS_PATH
                        path to the Multi-Illumination Dataset (train or test)
  --save_imgs           whether or not to save preprocessed images as PNG
  --png                 whether or not to save output as PNGs by default the albedo is saved as EXR

The images will be white-balanced using the light probe, tonemapped, and decomposed using our method and the median albedo will be computed. Each albedo will be stored alongside the HDR images.

License

The provided albedo images are licensed under CC BY-NC-SA 4.0

and intended for research purposes only. You can freely use it for scientific publications and include them in figures.

The methodology employed to generate this dataset is safeguarded under intellectual property protection. For inquiries regarding licensing opportunities, kindly reach out to SFU Technology Licensing Office <tlo_dir ατ sfu δøτ ca> and Yağız Aksoy <yagiz ατ sfu δøτ ca>.

Citation

This implementation is provided for academic use only. Please cite our paper if you use this code or dataset:

@ARTICLE{careagaIntrinsic,
  author={Chris Careaga and Ya\u{g}{\i}z Aksoy},
  title={Intrinsic Image Decomposition via Ordinal Shading},
  journal={ACM Trans. Graph.},
  year={2023},
}

midintrinsics's People

Contributors

ccareaga avatar compphoto avatar yaksoy avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

peterzs

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.