RameenAbdal / StyleFlow

StyleFlow: Attribute-conditioned Exploration of StyleGAN-generated Images using Conditional Continuous Normalizing Flows (ACM TOG 2021)
http://rameenabdal.github.io/StyleFlow
2.42k stars 342 forks source link

Obtaining light parameters for custom images #59

Open SURABHI-GUPTA opened 3 years ago

SURABHI-GUPTA commented 3 years ago

@RameenAbdal @shariqfarooq123 Thanks for sharing your code.

I have a doubt regarding trying StyleFlow on custom images. I tried getting the light parameters using DPR, but it returns 7 different images under different lighting conditions. For each image, we get 9 SH parameters. The 'data/light.npy' file store parameters of 1 such image (as the shape of the array is (1000,1,9,1,1)). So, can you specify which image's parameters are those stored in 'data/light.npy' file?

Also, could you explain what this part of the code actually doing in the app.py file? ''' light0 = torch.from_numpy(raw_lights[8]).float() light1 = torch.from_numpy(raw_lights[33]).float() light2 = torch.from_numpy(raw_lights[641]).float() light3 = torch.from_numpy(raw_lights[547]).float() light4 = torch.from_numpy(raw_lights[28]).float() light5 = torch.from_numpy(raw_lights[34]).float()

    pre_lighting = [light0, light1, light2, light3, light4, light5]

'''

RameenAbdal commented 3 years ago

https://github.com/zhhoper/DPR/blob/737efadaf09a2f0f2f8b1e7f8372c6734dfaa5bc/testNetwork_demo_1024.py#L87

outputSH in this part of the code predicts the lighting parameters of the given face, the other part does the relighting and shows 7 different examples. So you need to store the above tensor for lighting. light.npy stores these parameters for 1000 sampled images. light0, light1 ... are the selected light parameters for the UI, you can change them if you want to try some other lighting change.

SURABHI-GUPTA commented 3 years ago

@RameenAbdal Thanks. I got the first part. But, for [light0, light1 ...], why have you specifically taken 8, 33, 641, 547, 28, 34 as indices. These basically correspond to the lighting parameters of the sample face for indices 8, 33, 641, 547, 28, 34. How do they differ from other samples?

RameenAbdal commented 3 years ago

They differ in lighting parameters and closely represent the lighting changes labelled in the UI.