Code Monkey home page Code Monkey logo

Comments (6)

Kai-46 avatar Kai-46 commented on June 13, 2024

Hi -- can you share some of your rendered images?

Note that we do gamma-correct our mitsuba-rendered images (also w/ proper global scaling to reasonable brightness) and save as uint8 png images. Then we will use these png images (no inverse gamma correction) in the first stage; in the second stage, we will first inverse-gamma-correct the png images, as rendering equation is linear.

from iron.

arterms avatar arterms commented on June 13, 2024

Hello!
Without gamma-correction mitsuba-rendered images looks like under-exposed:
mitsuba_rendered
For the first stage I used this code for reading *.exr files, which performs gamma-correction to reasonable brightness:

IRON/models/dataset.py

Lines 69 to 78 in 5993e35

print("Loading png images failed; try loading exr images")
import pyexr
self.images_lis = sorted(glob(os.path.join(self.data_dir, "image/*.exr")))
self.n_images = len(self.images_lis)
self.images_np = np.clip(
np.power(np.stack([pyexr.open(im_name).get()[:, :, ::-1] for im_name in self.images_lis]), 1.0 / 2.2),
0.0,
1.0,
)

Is it flag --inv_gamma_gt supposed to be set during the second stage to perform inverse gamma-correction of the input images? I'm asking, because train_scene.sh script doesn't set this flag for the second stage.

from iron.

Kai-46 avatar Kai-46 commented on June 13, 2024

Hi -- the exr images need to be scaled (same scaling factor applied to all your training and test images) and then gamma-corrected to have well-exposed uint8 png images. I can share some example script to achieve this exr to png conversion later.

And yes, --inv_gamma_gt would be needed in the second stage for the synthetic data. (the setting in train_scene.sh was meant for real-world images; somehow I found that without this --inv_gamma_gt, the method recovers better specularity for real-world captures sometimes).

from iron.

arterms avatar arterms commented on June 13, 2024

Hello!
Thank you for the reply!
Could you suggest any reasonable scaling factor to apply for all exr images before gamma-correction (with grade 1/2.2)?

from iron.

Kai-46 avatar Kai-46 commented on June 13, 2024

Let's say you put all your training and test images into a tensor of shape [N, H, W, 3]; then a good heuristic might be to scale the 98-percentile (might worth trying other percentiles) of the flattened tensor to be 1; then you clip the scaled tensor to the range (0,1), and perform gamma correction, followed by saving as uint8 png.

from iron.

arterms avatar arterms commented on June 13, 2024

Hi!
I experimented a bit with the different percentiles for normalization and gamma-correction setups for the second stage. The best result I got is with 95-percentile and disabled --gamma_pred and enabled --inv_gamma_gt flags. Unfortunately, this result is still doesn't contain small details and sharp edges like that presented in the paper.
dragon_1024_00-00
dragon_1024__00-00
Do you have any suggestion how to tune configs/setups to get the shape more accurate?
Thanks!

from iron.

Related Issues (20)

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.