princeton-computational-imaging / NLOSFeatureEmbeddings

30 stars 10 forks source link

Resize operation and hardcoded values #1

Open grau4 opened 3 years ago

grau4 commented 3 years ago

Dear Wenzheng Chen, Dear Fangyin Wei,

thank you for making your excellent work publicly available!

As there are just a few comments throughout the code, I wonder if you could help me to clarify couple of operations within the network class "DeepVoxels", defined in "DL_inference/network7_256/deepvoxel.py". Between lines 110-115 the volume x, which has size (256,128,128) after applying LCT, is then resized/cropped along the zdim=256 by doing zdimnew = zdim * 100 // 128, which yields a zdimnew=200. Is there a particular reason as for why the volume should be resized at this point? Also, why 100 and 128? Is there a way to avoid hardcoded numbers in that step?

Best regards

fmu2 commented 3 years ago

Sorry for jumping into the discussion, but the reason is that LCT (and also f-k), when applied on raw measurements, would result in significant boundary artifacts. The maximum projection along the depth axis would look very cloudy on some datasets if one does not crop out the last few slices. A similar step also exists in the original Matlab implementation. I doubt this step is necessary when LCT is used as a network module though, as the features are completely learnable.

grau4 commented 3 years ago

That was my initial guess as well, I just never understood if there was a reason for those numbers in particular (even in the matlab implementations). I will assume the step to be not strictly necessary.

Thanks you for the advice @fmu2 !

wenzhengchen commented 3 years ago

Hi,

Sorry for the delay.

Yes, the answer by fm2 is correct Thanks @fmu2. After LCT, the range of x&y are still [-1, 1] while the range of z is [0, 2.56]. Thus, to make it a cube, we use fewer slices, choose its first 100/128. This is necessary if you need to rotate the cube, but if you only care about the front view without rotation, you can ignore it.